:root {
  color-scheme: light;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #1b2c43;
  background: #f3f6fa;
  --muted: #50627a;
  --edge: #dbe3ee;
  --blue: #1854a6;
  --navy: #142b4b;
  --surface: #fff;
  --radius: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, p, ul { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
button, a, input, select { outline-offset: 4px; }
:focus-visible { outline: 3px solid #5399e9; }

.frame { width: min(1100px, calc(100% - 48px)); margin-inline: auto; }
.top { background: var(--navy); color: #fff; }
.top-content { display: flex; justify-content: space-between; align-items: center; min-height: 66px; gap: 16px; }
.brand { font-size: 18px; letter-spacing: .02em; font-weight: 750; display: inline-flex; align-items: center; gap: 12px; white-space: nowrap; }
.brand-icon { width: 22px; height: 16px; border: 1.5px solid #b8d7ff; border-radius: 4px; display: block; position: relative; overflow: hidden; }
.brand-icon::after { content: ""; width: 14px; height: 14px; border: 1.5px solid #b8d7ff; position: absolute; transform: rotate(45deg); top: -9px; left: 3px; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px 18px; }
.top-actions .language-picker { width: auto; min-height: 35px; padding: 5px 9px; border-color: #9ab0c9; color: #1b2c43; font-size: 14px; }
:lang(bn) { font-family: "Nirmala UI", "Noto Sans Bengali", system-ui, sans-serif; }
.nav-link, .text-button { font-size: 14px; color: #e1ebfb; }
.nav-link:hover, .text-button:hover { text-decoration: underline; }
.text-button { border: 0; padding: 0; background: transparent; }

main { padding-block: 42px 56px; }
.page-heading { margin-bottom: 26px; }
.page-heading h1 { font-size: clamp(30px, 4vw, 40px); line-height: 1.15; letter-spacing: -.025em; }
.page-heading p { color: var(--muted); margin-top: 12px; line-height: 1.6; }
.panel { background: var(--surface); border: 1px solid var(--edge); border-radius: var(--radius); box-shadow: 0 3px 12px #1c365509; }
.search-panel, .management-panel, .login-panel { padding: 22px 24px; }
.search-panel { margin-bottom: 20px; }
.lookup-form { max-width: 680px; }
label, legend { display: block; font-size: 14px; font-weight: 680; line-height: 1.5; }
input:not([type="checkbox"]), select { width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid #aebed1; border-radius: 8px; color: inherit; background: #fff; min-height: 42px; }
input::placeholder { color: #65768d; }
.inline-form { display: flex; align-items: center; gap: 10px; margin-top: 7px; }
.inline-form > input { flex: 1; }
.inline-form button { flex: none; }
.select-wrap { min-width: 110px; }
.select-wrap select { margin-top: 6px; }
.grant-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grant-settings .select-wrap { min-width: 0; }
#custom-expiry { grid-column: 1 / -1; }
#link-expiry { margin-top: 6px; }
.primary, .outline { border-radius: 8px; padding: 10px 15px; border: 1px solid transparent; font-weight: 650; min-height: 42px; white-space: nowrap; }
.primary { color: #fff; background: var(--blue); }
.primary:hover:not(:disabled) { background: #124489; }
.outline { color: var(--blue); background: #fff; border-color: #a9c1df; }
.outline:hover:not(:disabled) { background: #edf4fd; }
.status, .secondary, .empty { font-size: 14px; color: var(--muted); line-height: 1.6; overflow-wrap: anywhere; }
.status { margin-top: 10px; }
.status:empty { display: none; }
.status.error { color: #9b2c2c; }
.empty { padding-block: 16px; }

.mail-grid { display: grid; grid-template-columns: minmax(255px, 3fr) minmax(0, 5fr); gap: 18px; align-items: start; }
.panel-heading { padding: 17px 20px; border-bottom: 1px solid var(--edge); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h2 { font-size: 20px; line-height: 1.4; overflow-wrap: anywhere; }
.panel-heading .secondary { margin-top: 2px; }
.list-panel { overflow: hidden; }
.list-panel .empty { padding-inline: 20px; }
.message-list, .entry-list { list-style: none; padding: 0; }
.message-list { max-height: 580px; overflow-y: auto; }
.message-list li + li { border-top: 1px solid #e8edf5; }
.message-row { width: 100%; padding: 13px 19px; color: inherit; background: #fff; border: 0; border-left: 3px solid transparent; text-align: start; display: grid; gap: 4px; }
.message-row:hover, .message-row[aria-pressed="true"] { background: #eef5fe; border-left-color: var(--blue); }
.message-row:focus-visible { outline-offset: -4px; }
.message-row strong, .message-row .secondary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-row .secondary { font-size: 13px; }
.detail-panel { padding: 22px 24px; min-height: 235px; }
.detail-panel h2 { margin-bottom: 8px; }
.code-box { margin-top: 18px; padding: 11px 14px; background: #edf5ff; border: 1px solid #c3d9f4; border-radius: 10px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.code-label { display: block; margin-bottom: 3px; font-size: 13px; color: var(--muted); }
.code-box strong { font: 700 25px ui-monospace, Consolas, monospace; letter-spacing: .09em; color: #1b4785; }
.mail-body { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 18px; line-height: 1.7; }

.login-panel { max-width: 475px; }
.stack-form { display: flex; flex-direction: column; gap: 8px; }
.stack-form > label:not(:first-child) { margin-top: 5px; }
.stack-form > button { align-self: flex-start; margin-top: 5px; }
.login-panel h2, .management-panel h2 { margin-bottom: 13px; }
.management { display: grid; gap: 18px; }
.admin-grid { display: grid; grid-template-columns: minmax(265px, 2fr) minmax(0, 3fr); gap: 18px; align-items: start; }
fieldset { min-width: 0; padding: 0; border: 0; margin: 0; }
.entry-list li { padding-block: 10px; display: flex; gap: 12px; align-items: center; justify-content: space-between; border-bottom: 1px solid #e8edf5; min-width: 0; }
.entry-list label, .entry-title { overflow-wrap: anywhere; min-width: 0; }
.entry-list label { display: flex; align-items: center; gap: 8px; }
.entry-list input { margin: 0; width: 17px; height: 17px; flex: none; accent-color: var(--blue); }
.entry-list .outline { min-height: 35px; padding: 6px 10px; font-size: 13px; }
.entry-title { font-size: 14px; }
.entry-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.link-settings-dialog { width: min(480px, calc(100% - 32px)); padding: 22px; color: inherit; }
.link-settings-dialog::backdrop { background: #142b4b66; }
.new-link { border-top: 1px solid var(--edge); margin-top: 15px; padding-top: 12px; }

@media (max-width: 720px) {
  .frame { width: calc(100% - 28px); }
  main { padding-block: 30px 45px; }
  .mail-grid, .admin-grid { grid-template-columns: 1fr; }
  .panel-heading, .search-panel, .detail-panel, .login-panel, .management-panel { padding-inline: 16px; }
  .top-actions { gap: 6px 12px; }
  .top-content { padding-block: 8px; }
  .message-list { max-height: 240px; }
}
