:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f6fa;
  color: #1f2329;
  --blue: #1677ff;
  --blue-dark: #0f56c8;
  --line: #e6eaf0;
  --muted: #6b7280;
  --soft-blue: #edf4ff;
  --green-bg: #e8f7ee;
  --green: #166534;
  --red-bg: #fdecec;
  --red: #b42318;
  --gray-bg: #eef2f7;
  --gray: #475467;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .7; }
.hidden { display: none !important; }
h1, h2, h3, p { margin: 0; }

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 46%) 1fr; background: #f6f8fb; }
.login-visual { display: grid; align-content: center; padding: 56px 64px; background: #102a56; color: #fff; }
.login-visual h1 { font-size: 42px; letter-spacing: 0; }
.login-visual p { margin-top: 16px; max-width: 420px; color: rgba(255,255,255,.74); line-height: 1.7; }
.login-illustration { position: relative; width: min(460px, 100%); height: 300px; margin-top: 42px; border: 1px solid rgba(255,255,255,.18); border-radius: 10px; background: rgba(255,255,255,.08); overflow: hidden; }
.mail-card-art { position: absolute; left: 48px; right: 48px; top: 58px; height: 166px; border: 1px solid rgba(255,255,255,.26); border-radius: 8px; background: rgba(255,255,255,.13); box-shadow: 0 24px 60px rgba(0,0,0,.22); }
.mail-card-art::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 54px; border-bottom: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.08); }
.mail-dot { position: absolute; top: 21px; width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.55); }
.mail-dot.one { left: 20px; }
.mail-dot.two { left: 38px; opacity: .75; }
.mail-dot.three { left: 56px; opacity: .5; }
.mail-line { position: absolute; left: 28px; height: 10px; border-radius: 999px; background: rgba(255,255,255,.46); }
.mail-line.long { top: 82px; width: 64%; }
.mail-line.mid { top: 112px; width: 46%; }
.mail-line.short { top: 142px; width: 28%; }
.code-chip { position: absolute; right: 24px; bottom: 22px; height: 34px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 7px; background: #fff; color: #102a56; font-weight: 800; letter-spacing: 0; }
.link-path { position: absolute; left: 84px; right: 84px; bottom: 38px; height: 42px; border-radius: 8px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.09); }
.link-path::before { content: ""; position: absolute; left: 18px; top: 16px; width: 52%; height: 9px; border-radius: 999px; background: rgba(255,255,255,.44); }
.shield { position: absolute; right: 34px; top: 24px; width: 64px; height: 76px; border-radius: 30px 30px 24px 24px; background: #79b8ff; box-shadow: 0 16px 34px rgba(0,0,0,.2); }
.shield::before { content: ""; position: absolute; left: 22px; top: 16px; width: 20px; height: 30px; border: 3px solid #102a56; border-top: 0; border-radius: 0 0 10px 10px; }
.shield::after { content: ""; position: absolute; left: 18px; top: 13px; width: 28px; height: 18px; border: 3px solid #102a56; border-bottom: 0; border-radius: 14px 14px 0 0; }
.login-panel-wrap { display: grid; place-items: center; padding: 32px; }
.login-card { width: min(420px, 100%); padding: 32px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 18px 50px rgba(15,23,42,.08); }
.login-card h2 { font-size: 28px; }
.login-card p { margin-top: 10px; color: var(--muted); }
.login-form { display: grid; gap: 14px; margin-top: 26px; }
.field { display: grid; gap: 8px; }
.field label { color: #374151; font-size: 14px; font-weight: 600; }
.password-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.show-password { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }

.text-input, .search-input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid #ccd4df; border-radius: 7px; background: #fff; }
.primary-button { height: 40px; padding: 0 16px; border: 0; border-radius: 7px; background: var(--blue); color: #fff; font-weight: 600; }
.primary-button:hover { background: var(--blue-dark); }
.primary-outline, .secondary-button, .danger-button { height: 40px; padding: 0 14px; border-radius: 7px; background: #fff; }
.primary-outline { border: 1px solid var(--blue); color: var(--blue); font-weight: 600; }
.secondary-button { border: 1px solid #ccd4df; color: #374151; font-weight: 600; }
.danger-button { border: 0; background: #ffe8eb; color: #d92d20; font-weight: 600; }

.admin-layout { min-height: 100vh; display: grid; grid-template-columns: 264px 1fr; }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 24px; }
.brand h1 { font-size: 24px; letter-spacing: 0; }
.brand p { margin-top: 7px; color: var(--muted); }
.side-section { margin-top: 28px; display: grid; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfe; }
.side-section h2 { font-size: 15px; }
.field-label { color: var(--muted); font-size: 14px; }
.side-hint { min-height: 20px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.workspace { min-width: 0; }
.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 30px; background: #fff; border-bottom: 1px solid var(--line); }
.search-input { width: min(460px, 100%); }
.content-shell { padding: 28px 30px; }
.headline { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.headline h2 { font-size: 30px; letter-spacing: 0; }
.headline p { margin-top: 8px; color: var(--muted); }
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.summary-card { padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.summary-card span { color: var(--muted); font-size: 13px; }
.summary-card strong { display: block; margin-top: 8px; font-size: 26px; }
.summary-card small { display: block; margin-top: 4px; color: var(--muted); }
.table-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px rgba(15,23,42,.05); overflow: hidden; }
.account-tabs { height: 64px; display: flex; align-items: flex-end; gap: 42px; padding: 0 24px; border-bottom: 1px solid var(--line); }
.account-tab { position: relative; height: 48px; border: 0; background: transparent; color: #8a8f99; font-size: 20px; font-weight: 700; }
.account-tab.active { color: var(--blue); }
.account-tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--blue); }
.account-tab small { margin-left: 8px; color: inherit; font-size: 14px; font-weight: 600; }
.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 24px; }
.toolbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-size-field { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.page-size-field .text-input { width: 76px; }
.table-wrap { overflow: auto; padding: 0 24px 18px; }
table { width: 100%; min-width: 1120px; border-collapse: collapse; }
th, td { height: 58px; padding: 0 14px; border-bottom: 1px solid #edf0f5; text-align: left; white-space: nowrap; }
th { background: #f8fafc; color: var(--muted); font-weight: 700; }
tbody tr:hover { background: #f8fbff; }
.actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.actions button, .mail-card button { border: 0; background: transparent; color: var(--blue); padding: 0; }
.link-danger { color: #f04438 !important; }
.badge { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.good { background: var(--green-bg); color: var(--green); }
.badge.bad { background: var(--red-bg); color: var(--red); }
.badge.neutral { background: var(--gray-bg); color: var(--gray); }
.badge.unused { background: var(--soft-blue); color: #174ea6; }
.empty-state { padding: 24px; color: var(--muted); text-align: center; }
.error-text { color: var(--red) !important; min-height: 20px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px; border-top: 1px solid var(--line); color: var(--muted); }
.pages { display: flex; align-items: center; gap: 10px; }
.page-button { height: 34px; padding: 0 12px; border: 1px solid #d8dee8; border-radius: 7px; background: #fff; color: #374151; }
.page-button:disabled { cursor: not-allowed; opacity: .45; }

.modal { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 24px; background: rgba(17, 24, 39, .55); }
.modal-panel { width: min(900px, 100%); max-height: min(760px, calc(100vh - 48px)); display: grid; grid-template-rows: auto 1fr auto; background: #fff; border-radius: 8px; box-shadow: 0 20px 60px rgba(15, 23, 42, .24); overflow: hidden; }
.modal-panel.wide { width: min(1080px, 100%); }
.modal-panel.mail-modal-panel { width: min(980px, 100%); }
.modal-panel > header, .modal-panel > footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 22px; border-bottom: 1px solid #e5eaf1; }
.modal-panel > footer { border-top: 1px solid #e5eaf1; border-bottom: 0; justify-content: flex-end; }
.modal-panel textarea { width: calc(100% - 44px); min-height: 360px; margin: 0 22px 22px; padding: 12px; border: 1px solid var(--blue); border-radius: 6px; resize: vertical; line-height: 1.5; }
.icon-button { border: 0; background: transparent; font-size: 26px; color: var(--muted); }
.mail-list { overflow: auto; padding: 0 22px 22px; }
.mail-tabs { display: flex; align-items: flex-end; gap: 38px; padding: 18px 22px 0; border-bottom: 1px solid #e5eaf1; }
.mail-tab { position: relative; height: 44px; border: 0; background: transparent; color: #7b8494; font-size: 17px; font-weight: 700; }
.mail-tab.active { color: var(--blue); }
.mail-tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--blue); }
.mail-count { min-width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; margin-left: 8px; padding: 0 8px; border-radius: 999px; background: #eef2f7; color: #475467; font-size: 13px; }
.mail-tab.active .mail-count { background: #e6f0ff; color: var(--blue); }
.mailbox-panel { display: grid; gap: 14px; padding-top: 18px; }
.mailbox-panel.hidden { display: none; }
.mailbox-heading-inline { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; }
.mailbox-section { margin-top: 18px; padding: 16px; border: 1px solid #dfe7d5; border-radius: 8px; background: #fbfdf8; }
.mailbox-section.junk { border-color: #f3dddd; background: #fffafa; }
.mailbox-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px dashed #d8e3cc; }
.mailbox-heading h3 { color: #5c8a1f; }
.mailbox-section.junk .mailbox-heading h3 { color: #d14343; }
.mailbox-heading span { color: var(--muted); font-size: 13px; }
.mail-card { padding: 16px 0; border-bottom: 1px solid #edf0f5; }
.mail-card:last-child { border-bottom: 0; }
.mail-card header { display: flex; justify-content: space-between; gap: 18px; }
.mail-card h3 { font-size: 16px; overflow-wrap: anywhere; white-space: normal; }
.mail-card p { margin-top: 6px; color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
.codes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.codes code { min-height: 30px; display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 6px; background: #eef4ff; color: #174ea6; font-size: 16px; font-weight: 700; letter-spacing: 0; }
details { margin-top: 10px; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; background: #f8fafc; border: 1px solid #e5eaf1; border-radius: 6px; padding: 14px; line-height: 1.55; }
.mail-frame { width: 100%; height: 520px; margin-top: 10px; border: 1px solid #e5eaf1; border-radius: 8px; background: #fff; }
.muted { color: #8a98a8; }
.share-shell { width: min(880px, calc(100% - 32px)); margin: 40px auto; }
.share-card { background: #fff; border: 1px solid #dfe4ec; border-radius: 8px; padding: 24px; }
.share-card header { padding-bottom: 16px; border-bottom: 1px solid #edf0f5; }
.share-card h1 { font-size: 24px; overflow-wrap: anywhere; }
.share-card header p { margin-top: 8px; color: var(--muted); overflow-wrap: anywhere; }
.share-meta { display: grid; gap: 8px; margin-top: 18px; }
.inbox-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.inbox-list { margin-top: 18px; }
.copy-code { border: 0; background: transparent; padding: 0; }
@media (max-width: 980px) {
  .login-page, .admin-layout { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar, .headline, .table-toolbar, .pagination { height: auto; display: grid; }
  .content-shell { padding: 18px; }
}
