/* ================= Shared ================= */
body { font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
.brand-logo { width: 64px; height: 64px; border-radius: 16px; margin: 0 auto 12px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand, #1a73e8), var(--brand-dark, #0b4fae)); color: #fff; font-size: 32px; }
.brand-logo.has-img { background: none; width: auto; height: auto; }
.brand-logo.has-img img { max-height: 72px; max-width: 220px; }
.wm-powered, .cp-powered { font-size: 11px; color: #9aa0a6; }
.wm-powered a, .cp-powered a { color: inherit; }
.cp-powered { text-align: center; padding: 10px 0 4px; }

/* ================= Login / landing ================= */
.login-bg { min-height: 100vh; background: linear-gradient(160deg, #eef3fb 0%, #dfe8f6 100%); display: flex; align-items: center; justify-content: center; }
.login-box { width: 100%; max-width: 400px; padding: 16px; }

/* ================= Webmail ================= */
body.wm { background: #f6f8fc; height: 100vh; overflow: hidden; }
.wm-top { height: 60px; background: var(--brand, #0b4fae); color: #fff; display: flex; align-items: center; padding: 0 16px; gap: 16px; }
.wm-brand { color: #fff; text-decoration: none; font-weight: 600; font-size: 19px; white-space: nowrap; min-width: 220px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; max-width: 45vw; }
.wm-brand span { font-weight: 300; opacity: .8; }
.wm-brand .brand-img { height: 30px; max-width: 120px; object-fit: contain; vertical-align: middle; margin-right: 6px; background: #fff; border-radius: 4px; padding: 2px; }
.wm-brand:hover { color: #fff; }
.wm-search { flex: 1 1 auto; min-width: 0; max-width: 680px; background: rgba(255,255,255,.15); border-radius: 8px; align-items: center; padding: 0 12px; }
.wm-search input { background: transparent; border: 0; color: #fff; padding: 9px 10px; width: 100%; outline: none; }
.wm-search input::placeholder { color: rgba(255,255,255,.7); }
.wm-avatar { width: 38px; height: 38px; border-radius: 50%; background: #f4b400; color: #fff; font-weight: 600; padding: 0; }
.wm-avatar::after { display: none; }
.wm-body { display: flex; height: calc(100vh - 60px); }
.wm-side { width: 250px; flex-shrink: 0; padding: 14px 10px; overflow-y: auto; display: flex; flex-direction: column; }
.wm-compose { background: #c2e7ff; color: #001d35; border-radius: 16px; padding: 14px 22px; font-weight: 500; box-shadow: 0 1px 3px rgba(0,0,0,.15); align-self: flex-start; }
.wm-compose:hover { background: #b1dcfa; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.wm-folder { display: flex; align-items: center; gap: 14px; padding: 7px 14px; border-radius: 0 18px 18px 0; color: #202124; text-decoration: none; font-size: 14px; margin-right: 6px; }
.wm-folder span:not(.badge) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wm-folder:hover { background: #e8eaed; color: #202124; }
.wm-folder.active { background: #d3e3fd; font-weight: 600; }
.wm-side-title { font-size: 12px; text-transform: uppercase; color: #5f6368; margin: 16px 14px 4px; letter-spacing: .04em; }
.wm-quota { margin-top: auto; padding: 14px; }
.wm-main { flex: 1; background: #fff; border-radius: 16px 0 0 0; overflow-y: auto; margin-top: 8px; }
.wm-main > .alert { margin: 12px 16px 0; }
.wm-toolbar { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid #eceff1; position: sticky; top: 0; background: #fff; z-index: 5; }
.wm-row { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-bottom: 1px solid #f1f3f4; color: #202124; text-decoration: none; font-size: 14px; }
.wm-row:hover { box-shadow: inset 1px 0 0 #dadce0, inset -1px 0 0 #dadce0, 0 1px 2px rgba(60,64,67,.3); color: #202124; position: relative; z-index: 1; }
.wm-row-to { width: 170px; flex-shrink: 0; white-space: nowrap; }
.wm-row-subject { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.wm-row-status { width: 100px; flex-shrink: 0; text-align: right; }
.wm-row-date { width: 80px; flex-shrink: 0; text-align: right; font-size: 12px; font-weight: 600; }
.wm-empty { text-align: center; padding: 80px 20px; color: #5f6368; }
.wm-empty > i { font-size: 64px; opacity: .3; display: block; margin-bottom: 8px; }
.wm-bulk { display: flex; gap: 8px; align-items: center; padding: 8px 16px; background: #e8f0fe; flex-wrap: wrap; }

/* compose */
.wm-compose-card { max-width: 1000px; margin: 16px auto; border: 1px solid #e0e3e7; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,.06); background: #fff; }
.wm-compose-head { display: flex; align-items: center; padding: 10px 16px; background: #f2f6fc; }
.wm-field { display: flex; align-items: flex-start; padding: 8px 16px; border-bottom: 1px solid #eceff1; gap: 10px; }
.wm-field > label { width: 60px; flex-shrink: 0; color: #5f6368; font-size: 14px; padding-top: 6px; }
.wm-plain { border: 0 !important; box-shadow: none !important; padding-left: 0; }
.wm-chips { min-height: 36px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; cursor: pointer; padding: 3px 0; }
.wm-chip { display: inline-flex; align-items: center; gap: 6px; background: #f1f3f4; border: 1px solid #dadce0; border-radius: 16px; padding: 2px 4px 2px 12px; font-size: 13px; }
.wm-chip button { border: 0; background: transparent; font-size: 16px; line-height: 1; color: #5f6368; padding: 0 6px; }
.wm-chip-group { background: #e8f0fe; border-color: #c6dafc; color: #174ea6; }
.wm-chip-list { background: #e6f4ea; border-color: #b7dfc3; color: #137333; font-weight: 600; }
.wm-editor-wrap .ql-toolbar { border-left: 0; border-right: 0; }
.wm-editor-wrap .ql-container { border: 0; min-height: 320px; font-size: 15px; }
.wm-editor-wrap #htmlEditor { border: 0; border-radius: 0; min-height: 360px; }
.wm-compose-foot { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid #eceff1; flex-wrap: wrap; }
.wm-book tbody tr { cursor: pointer; }

/* read view */
.wm-read { padding: 20px 24px; max-width: 1100px; }
.wm-avatar-lg { width: 42px; height: 42px; border-radius: 50%; background: #1a73e8; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 18px; flex-shrink: 0; }
.wm-preview { width: 100%; height: 520px; border: 0; display: block; }

@media (max-width: 991px) {
  .wm-side { position: fixed; top: 60px; left: 0; bottom: 0; background: #f6f8fc; z-index: 20; transform: translateX(-100%); transition: transform .2s; box-shadow: 2px 0 8px rgba(0,0,0,.15); }
  body.wm-nav-open .wm-side { transform: none; }
  .wm-brand { width: auto; }
  .wm-main { border-radius: 0; margin-top: 0; }
  .wm-row-to { width: 110px; } .wm-row-status { display: none; }
}

/* ================= cPanel-style admin ================= */
body.cp { background: #f1f3f6; font-size: 14px; }
.cp-top { background: #293a4a; color: #fff; height: 56px; display: flex; align-items: center; padding: 0 18px; gap: 18px; position: sticky; top: 0; z-index: 30; }
.cp-logo { color: #fff; text-decoration: none; font-size: 21px; font-weight: 300; letter-spacing: .02em; white-space: nowrap; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; max-width: 45vw; }
.cp-logo b { color: #ff6c2c; font-weight: 700; }
.cp-logo-img { height: 30px; max-width: 110px; object-fit: contain; background: #fff; border-radius: 3px; padding: 2px; margin-right: 8px; vertical-align: middle; }
.cp-logo:hover { color: #fff; }
.cp-search { flex: 1 1 auto; min-width: 0; max-width: 520px; position: relative; }
.cp-search input { width: 100%; background: #fff; border: 0; border-radius: 3px; padding: 7px 12px 7px 34px; font-size: 14px; }
.cp-search i { position: absolute; left: 11px; top: 8px; color: #888; }
.cp-top .dropdown-toggle { color: #fff; }
.cp-side { width: 64px; background: #1f2d3a; position: fixed; top: 56px; bottom: 0; left: 0; padding-top: 8px; z-index: 20; }
.cp-side a { display: block; color: #9fb1c2; text-align: center; padding: 12px 0; font-size: 20px; }
.cp-side a:hover, .cp-side a.active { color: #fff; background: #179bd7; }
.cp-wrap { margin-left: 64px; padding: 20px 24px; }
.cp-crumb { font-size: 22px; font-weight: 300; color: #333; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.cp-crumb i { color: #179bd7; }
.cp-panel { background: #fff; border: 1px solid #dde1e5; border-radius: 3px; margin-bottom: 18px; }
.cp-panel-head { padding: 10px 16px; font-size: 17px; font-weight: 400; color: #333; border-bottom: 1px solid #e7e9ec; display: flex; align-items: center; cursor: pointer; user-select: none; }
.cp-panel-head .bi-chevron-up { margin-left: auto; color: #999; font-size: 13px; transition: transform .2s; }
.cp-panel.collapsed .bi-chevron-up { transform: rotate(180deg); }
.cp-panel.collapsed .cp-panel-body { display: none; }
.cp-panel-body { padding: 14px 10px; }
.cp-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 8px; }
.cp-tile { display: flex; align-items: center; gap: 12px; padding: 8px 10px; color: #0e6aa6; text-decoration: none; border-radius: 3px; }
.cp-tile:hover { background: #f1f7fb; color: #0a4f7c; text-decoration: underline; }
.cp-icon { width: 42px; height: 42px; flex-shrink: 0; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 22px; color: #fff; }
.ic-blue { background: linear-gradient(135deg, #3aa0e0, #1672b5); }
.ic-orange { background: linear-gradient(135deg, #ff9a4d, #e8641b); }
.ic-green { background: linear-gradient(135deg, #5cc77a, #2e9c4f); }
.ic-purple { background: linear-gradient(135deg, #a07be0, #6b47b8); }
.ic-red { background: linear-gradient(135deg, #f0707a, #c93a46); }
.ic-teal { background: linear-gradient(135deg, #4cc6c2, #1f8f8b); }
.ic-gray { background: linear-gradient(135deg, #9aa6b2, #66727e); }
.cp-info dt { font-weight: 400; color: #777; font-size: 13px; }
.cp-info dd { margin-bottom: 12px; color: #222; word-break: break-all; }
.cp-stat { margin-bottom: 14px; }
.cp-stat .lbl { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 3px; }
.cp-stat .lbl a { color: #0e6aa6; text-decoration: none; }
.cp-stat .progress { height: 7px; border-radius: 0; }
.cp-table { background: #fff; }
.cp-table th { background: #f7f8fa; font-weight: 600; font-size: 13px; color: #555; }
@media (max-width: 767px) { .cp-side { display: none; } .cp-wrap { margin-left: 0; padding: 14px; } .cp-search { display: none; } }

/* cookie notice */
.ck-notice { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 560px; margin: 0 auto; z-index: 2000; background: #202124; color: #fff;
  border-radius: 10px; padding: 12px 16px; display: flex; gap: 14px; align-items: center; font-size: 13px; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.ck-notice.d-none { display: none !important; }
