/*
 * Member panel. The page loads the public site's style sheets (material-kit and style.min.css),
 * so colours, type, cards and buttons come from there (--primary, --text-heading, --border-color,
 * --radius-*). This file only adds the panel's own layout. Header and footer: panel-chrome.css.
 */
.panel {
  --danger: #be123c; --danger-light: #fff1f2;
  color: var(--text-body);
}
.panel [hidden], dialog [hidden] { display: none !important; }
.panel h2 { font-size: 1.05rem; font-weight: 700; color: var(--text-heading); line-height: 1.3; margin: 0 0 .5rem; }
.panel h2.h4 { font-size: 1.35rem; margin-bottom: 1rem; }
.panel h3 { font-size: 1.1rem; font-weight: 700; color: var(--text-heading); line-height: 1.3; margin: 1rem 0 .5rem; }
.panel a:not(.btn) { color: var(--primary); }
.panel :focus-visible, dialog :focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.hero-user { margin: .5rem 0 0; color: #cbd5e1; font-size: .95rem; overflow-wrap: anywhere; }

/* Cards: the site's .card, without Material Kit's outer margins */
.panel .card { margin: 0 0 1rem; padding: 1.25rem; min-width: 0; }
.panel .narrow { max-width: 420px; margin: 1rem auto; }
.panel .skeleton { min-height: 360px; display: grid; place-items: center; color: var(--text-muted); }
.panel .grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) { .panel .grid { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); } }
.panel .inbox { min-height: 420px; }

/* Forms: same field look as the site's own dialogs (recovery key, change domain) */
.panel form { display: flex; flex-direction: column; gap: .75rem; margin: 0; }
.panel label { display: flex; flex-direction: column; gap: .25rem; margin: 0; font-weight: 600; font-size: .9rem; color: var(--text-heading); }
.panel .form-control { height: 42px; border: 1px solid #cbd5e1; border-radius: 8px; padding: 0 12px; font-weight: 500; background-image: none; background-color: #fff; color: var(--text-heading); min-width: 0; }
.panel .form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); background-image: none; }
.panel small, .panel .small { font-size: .85rem; }
.panel form small { color: var(--text-muted); }
.panel .muted { color: var(--text-muted); }
.panel .break { overflow-wrap: anywhere; }

/* Buttons: the site's .btn classes; panel buttons keep a comfortable touch height */
.panel .btn, dialog .btn { margin: 0; min-height: 40px; }
.panel .btn-sm { min-height: 36px; }
.panel .btn:disabled { opacity: .55; cursor: not-allowed; }
.panel .btn.text-danger { color: var(--danger) !important; text-transform: none; font-weight: 600; padding-left: .5rem; padding-right: .5rem; }
.panel .btn.text-danger:hover { background: var(--danger-light); }
.panel .btn-danger, dialog .btn-danger { background: var(--danger); color: #fff; box-shadow: none; }
.panel .link { background: none; border: 0; padding: .5rem; color: var(--primary); font: inherit; font-size: .9rem; cursor: pointer; text-align: center; text-decoration: none; }
.panel .link:hover { color: var(--primary-hover); }

.panel .tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 1rem; background: var(--border-light); border-radius: 10px; }
.panel .tabs button { min-height: 40px; border: 0; border-radius: 8px; background: transparent; font: inherit; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.panel .tabs button[aria-pressed="true"] { background: #fff; color: var(--text-heading); box-shadow: var(--shadow-sm); }
.panel .divider { display: flex; align-items: center; gap: .75rem; margin: 1rem 0; color: var(--text-muted); font-size: .85rem; }
.panel .divider::before, .panel .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border-color); }
.panel #googleBox .btn { width: 100%; }

.panel .notice { background: var(--primary-light); border: 1px solid #bfdbfe; border-radius: 8px; padding: .75rem 1rem; margin: 0 0 1rem; color: var(--text-heading); }
.panel .notice.error, .panel .form-error { background: var(--danger-light); border: 1px solid #fecdd3; color: var(--danger); }
.panel .form-error { margin: 0; padding: .5rem .75rem; border-radius: 8px; font-size: .9rem; }

.panel .row-between { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.panel .grow { flex: 1; min-width: 0; }
.panel .pill { background: var(--border-light); border-radius: var(--radius-pill); padding: 0 .6rem; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.panel .actions, dialog .actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.panel .actions.end, dialog .actions.end { justify-content: flex-end; }
.panel #newAddress .btn { width: 100%; }

.panel .list { list-style: none; margin: .75rem 0; padding: 0; }
.panel .address { border: 1px solid var(--border-color); border-radius: 10px; padding: .5rem; margin-bottom: .5rem; }
.panel .address.is-open { border-color: var(--primary); background: var(--primary-light); }
.panel .item-open { display: flex; justify-content: space-between; align-items: center; gap: .5rem; width: 100%; padding: .25rem; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; color: var(--text-heading); }
.panel .address .item-open { font-weight: 600; }
.panel .address .actions { margin-top: .25rem; }
.panel .count { background: var(--primary); color: #fff; border-radius: var(--radius-pill); padding: 0 .5rem; font-size: .75rem; font-weight: 700; white-space: nowrap; }

.panel .messages li { border-top: 1px solid var(--border-color); }
.panel .messages .item-open { flex-direction: column; align-items: stretch; gap: 0; padding: .75rem .5rem; }
.panel .messages .item-open:hover { background: var(--bg-page); }
.panel .messages span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel .messages .unread .from, .panel .messages .unread .subject { font-weight: 700; }
.panel .messages .unread { box-shadow: inset 3px 0 0 var(--primary); }
.panel .empty { display: grid; place-items: center; min-height: 260px; color: var(--text-muted); text-align: center; margin: 0; }
.panel #msgBody iframe { width: 100%; height: 460px; border: 1px solid var(--border-color); border-radius: 8px; background: #fff; }
.panel #msgBody pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; border: 1px solid var(--border-color); border-radius: 8px; padding: .75rem; margin: 0; max-height: 460px; overflow: auto; }

.panel progress { width: 100%; height: 8px; accent-color: var(--primary); }
.panel .danger summary { cursor: pointer; font-weight: 600; color: var(--danger); }
.panel .danger .btn { align-self: flex-start; }

dialog { border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 1.25rem; max-width: min(420px, calc(100vw - 2rem)); color: var(--text-body); overflow-wrap: anywhere; }
dialog form { display: flex; flex-direction: column; gap: .75rem; margin: 0; }
dialog::backdrop { background: rgba(15, 23, 42, .55); }

/* Turnstile (managed widget): the box keeps its height so the form does not jump */
.panel .turnstile-box { min-height: 65px; margin: .25rem 0 .5rem; }
.panel .turnstile-note { margin: 0 0 .5rem; font-size: .85rem; color: var(--text-muted); }
.panel .turnstile-note.error { padding: .5rem .75rem; border-radius: 8px; background: var(--danger-light); border: 1px solid #fecdd3; color: var(--danger); }

@media (max-width: 480px) { .panel .card { padding: 1rem; } }
