/* Docshar accounts: header account area, sign-in pages, dashboard, receipt, upgrade and payment dialogs.
 * Loaded by the generated content pages (scripts/build-pages.js) and by index.html. Plain CSS with literal
 * colours, so it works both next to css/pages.css and next to Tailwind on the app page. */

/* ---------- Header account area ---------- */
.da-nav { display: inline-flex; align-items: center; gap: 4px; }
.da-nav:empty { display: none; }
.da-link, .site-nav .da-link { color: #000; text-decoration: none; font-size: 14px; font-weight: 600; padding: 8px 10px; border-radius: 10px; white-space: nowrap; line-height: 1.2; }
.da-link:hover { background: #f4f4f5; color: #1f6bff; }
/* On the content pages the account links look like the other header links. */
.site-nav .da-link { color: var(--text, #3f3f46); font-weight: 500; padding: 8px 12px; }
.site-nav .da-link:hover { background: #f1f5f9; color: var(--ink, #18181b); }
.da-signup, .site-nav .da-signup { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 10px; font-size: 14px; font-weight: 600; color: #fff; background: #4f46e5; text-decoration: none; white-space: nowrap; box-shadow: 0 2px 8px rgba(79, 70, 229, .22); line-height: 1; }
.da-signup:hover { background: #4338ca; color: #fff; }
.da-menu { position: relative; }
.da-menu-btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 8px 0 4px; border: 1px solid #e4e4e7; border-radius: 999px; background: #fff; color: #000; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; max-width: 220px; }
.da-menu-btn:hover, .da-menu-btn[aria-expanded="true"] { background: #f4f4f5; }
.da-avatar { width: 28px; height: 28px; border-radius: 999px; background: linear-gradient(135deg, #1f6bff, #5b1cff); color: #fff; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.da-menu-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.da-caret { width: 7px; height: 7px; border-right: 2px solid #71717a; border-bottom: 2px solid #71717a; transform: translateY(-2px) rotate(45deg); flex: none; margin-right: 4px; }
.da-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.da-pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 240px; background: #fff; border: 1px solid #e4e4e7; border-radius: 14px; box-shadow: 0 12px 32px rgba(15, 23, 42, .14); padding: 6px; z-index: 1000; }
.da-pop[hidden] { display: none; }
.da-pop-head { padding: 8px 10px 10px; border-bottom: 1px solid #f1f5f9; margin-bottom: 4px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: #52525b; line-height: 1.4; }
.da-pop-head b { color: #18181b; font-size: 14px; }
.da-pop-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.da-plan-chip { align-self: flex-start; margin-top: 4px; font-size: 11.5px; font-weight: 600; color: #4338ca; background: #eef2ff; border-radius: 999px; padding: 1px 8px; }
.da-pop a, .da-pop button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; color: #000; text-decoration: none; font: inherit; font-size: 14px; font-weight: 500; line-height: 1.4; background: none; border: 0; cursor: pointer; }
.da-pop a:hover, .da-pop button:hover, .da-pop a:focus-visible, .da-pop button:focus-visible { background: #f0f4ff; color: #1f6bff; }
.da-pop button { border-top: 1px solid #f1f5f9; margin-top: 4px; border-radius: 0 0 8px 8px; }
/* list variant (mobile menu on the app page) */
.da-mlist { display: flex; flex-direction: column; gap: 2px; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid #e4e4e7; }
.da-mlink { display: block; width: 100%; text-align: left; padding: .75rem 1rem; font-size: .875rem; font-weight: 500; color: #000; text-decoration: none; border-radius: .5rem; background: none; border: 0; font-family: inherit; cursor: pointer; }
.da-mlink:hover { background: #f4f4f5; color: #1f6bff; }
.da-mlink-cta { color: #4338ca; background: #eef2ff; font-weight: 600; }
.da-mhead { display: flex; align-items: center; gap: 10px; padding: .5rem 1rem .75rem; }
.da-mwho { display: flex; flex-direction: column; min-width: 0; font-size: 14px; line-height: 1.3; }
.da-mwho b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #18181b; }
.da-mwho small { color: #64748b; font-size: 12px; }

@media (max-width: 560px) {
  .site-nav .nav-secondary { display: none; }
  .site-nav .da-link, .site-nav a { padding: 8px 9px; }
  .site-nav .da-signup { padding: 0 12px; }
  .da-menu-name { display: none; }
  .da-menu-btn { padding: 0 6px 0 4px; }
}

/* ---------- Sign-in pages ---------- */
main.auth-main { max-width: 480px; padding-top: 36px; }
.auth-card { padding: 28px 28px 24px; }
.auth-card h1 { font-size: 27px; margin-bottom: 6px; }
.auth-lead { margin: 0 0 18px; color: #52525b; font-size: 15.5px; line-height: 1.55; }
.form-alert { border-radius: 12px; padding: 10px 14px; font-size: 14.5px; line-height: 1.5; margin: 0 0 16px; border: 1px solid #fecaca; background: #fef2f2; color: #991b1b; }
.form-alert.ok { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.form-alert.info { border-color: #c7d2fe; background: #eef2ff; color: #312e81; }
.form-alert a { color: inherit; font-weight: 600; }
.form-alert:focus { outline: none; }
.btn-google { width: 100%; min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid #d4d4d8; background: #fff; border-radius: 14px; font: inherit; font-size: 15px; font-weight: 600; color: #18181b; cursor: pointer; }
.btn-google:hover { background: #f8fafc; }
.btn-google:disabled { opacity: .6; cursor: progress; }
.or { display: flex; align-items: center; gap: 12px; color: #94a3b8; font-size: 13px; margin: 16px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: #e2e8f0; }
.field { margin: 0 0 14px; }
.field label { display: block; font-size: 14px; font-weight: 600; color: #18181b; margin: 0 0 6px; }
.field .opt { font-weight: 400; color: #64748b; }
.field input { width: 100%; height: 46px; border: 1px solid #cbd5e1; border-radius: 12px; padding: 0 14px; font: inherit; font-size: 16px; color: #18181b; background: #fff; }
.field input:focus { outline: 2px solid #4f46e5; outline-offset: 0; border-color: #4f46e5; }
.field input[aria-invalid="true"] { border-color: #dc2626; }
.field-err { color: #b91c1c; font-size: 13.5px; margin: 6px 0 0; line-height: 1.45; }
.pw { position: relative; }
.pw input { padding-right: 72px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); height: 34px; padding: 0 10px; border: 0; background: #f1f5f9; border-radius: 9px; font: inherit; font-size: 13px; font-weight: 600; color: #334155; cursor: pointer; }
.hint { font-size: 13.5px; color: #64748b; margin: -6px 0 14px; line-height: 1.45; }
.hint.ok { color: #047857; }
.form-aside { margin: -4px 0 16px; font-size: 14px; text-align: right; }
.form-aside.center { text-align: center; margin: 14px 0 0; }
.btn-block { width: 100%; border: 0; cursor: pointer; font-family: inherit; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .65; cursor: progress; }
.fine { font-size: 13px; color: #64748b; margin: 12px 0 0; line-height: 1.5; }
.auth-switch { text-align: center; font-size: 14.5px; margin: 18px 0 0; color: #52525b; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: #4f46e5; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.linklike:disabled { color: #94a3b8; cursor: default; text-decoration: none; }
.auth-done { text-align: center; }
.auth-done h2 { font-size: 21px; color: #18181b; margin: 4px 0 8px; }
.auth-done p { margin: 0 0 14px; }
.done-icon { width: 56px; height: 56px; border-radius: 999px; margin: 0 auto 8px !important; display: flex; align-items: center; justify-content: center; font-size: 26px; background: #eef2ff; color: #4f46e5; }
.done-icon.ok { background: #ecfdf5; color: #059669; }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 999px; animation: da-spin .7s linear infinite; vertical-align: -3px; }
@keyframes da-spin { to { transform: rotate(360deg); } }

/* ---------- Dashboard ---------- */
main.acct-main { max-width: 980px; }
.acct-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.acct-head h1 { margin-bottom: 2px; }
.acct-sub { margin: 0; color: #64748b; font-size: 15px; overflow-wrap: anywhere; }
.test-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: #92400e; background: #fef3c7; border: 1px solid #fde68a; border-radius: 999px; padding: 4px 12px; }
.test-badge[hidden] { display: none; }
.acct-tabs { display: flex; gap: 4px; border-bottom: 1px solid #e2e8f0; margin: 0 0 20px; overflow-x: auto; scrollbar-width: none; }
.acct-tabs::-webkit-scrollbar { display: none; }
.acct-tabs a { flex: none; padding: 10px 14px; font-size: 14.5px; font-weight: 600; color: #475569; text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.acct-tabs a:hover { color: #18181b; }
.acct-tabs a[aria-selected="true"] { color: #4f46e5; border-bottom-color: #4f46e5; }
.acct-loading { color: #64748b; padding: 28px 0; display: flex; align-items: center; gap: 10px; }
.acct-loading[hidden] { display: none; }
.acct-panel[hidden] { display: none; }
.acct-panel:focus { outline: none; }
.acct-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 0 0 18px; }
.stat { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 18px; min-width: 0; }
.stat .k { font-size: 12.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: #64748b; margin: 0 0 6px; }
.stat .v { font-size: 22px; font-weight: 800; color: #18181b; margin: 0; line-height: 1.25; overflow-wrap: anywhere; }
.stat .s { font-size: 14px; color: #52525b; margin: 6px 0 0; line-height: 1.5; }
.meter { height: 8px; background: #eef2ff; border-radius: 999px; overflow: hidden; margin: 10px 0 0; }
.meter > span { display: block; height: 100%; background: linear-gradient(90deg, #4f46e5, #7c3aed); border-radius: 999px; }
.meter.full > span { background: #dc2626; }
.acct-section { background: #fff; border: 1px solid #e2e8f0; border-radius: 18px; padding: 22px; margin: 0 0 18px; }
.acct-section h2 { font-size: 18px; color: #18181b; margin: 0 0 6px; font-weight: 700; }
.acct-section > p { margin: 0 0 12px; font-size: 15px; }
.acct-section .table-wrap { margin-bottom: 0; }
.acct-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 11px; }
.btn.danger { background: #fff; color: #b91c1c !important; border: 1px solid #fecaca; box-shadow: none; }
.btn.danger:hover { background: #fef2f2; }
button.btn { border: 0; cursor: pointer; font-family: inherit; }
button.btn.ghost, button.btn.danger { border: 1px solid #e2e8f0; }
button.btn.danger { border-color: #fecaca; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 1px 9px; background: #f1f5f9; color: #334155; white-space: nowrap; }
.pill.ok { background: #ecfdf5; color: #047857; }
.pill.warn { background: #fffbeb; color: #92400e; }
.pill.bad { background: #fef2f2; color: #b91c1c; }
.empty { color: #64748b; font-size: 15px; margin: 4px 0 0; }
.limits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 8px 0 0; padding: 0; list-style: none; }
.limits li { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 10px 12px; margin: 0; font-size: 14px; line-height: 1.4; }
.limits b { display: block; font-size: 17px; color: #18181b; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { flex: 1 1 240px; margin: 0; }
table.acct-table td, table.acct-table th { white-space: nowrap; }
table.acct-table td.wrap { white-space: normal; }
.row-btn { background: none; border: 0; color: #b91c1c; font: inherit; font-size: 13.5px; cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 2px; }
@media (max-width: 760px) {
  .acct-grid, .limits { grid-template-columns: minmax(0, 1fr); }
  .acct-section { padding: 18px 16px; }
  .auth-card { padding: 22px 18px 20px; }
  main.auth-main { padding-top: 22px; }
}

/* ---------- Receipt ---------- */
main.receipt-main { max-width: 760px; }
.receipt-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; }
.receipt h1 { font-size: 26px; margin: 0 0 4px; }
.receipt .r-top { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-bottom: 1px solid #e2e8f0; padding-bottom: 16px; margin-bottom: 16px; }
.receipt .r-brand { font-weight: 800; font-size: 20px; color: #0b1437; }
.receipt dl { display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr); gap: 8px 16px; margin: 0; font-size: 15px; }
.receipt dt { color: #64748b; }
.receipt dd { margin: 0; color: #18181b; overflow-wrap: anywhere; }
.receipt .r-total { display: flex; justify-content: space-between; font-size: 19px; font-weight: 800; color: #18181b; border-top: 1px solid #e2e8f0; margin-top: 16px; padding-top: 14px; }
.receipt .r-note { font-size: 13px; color: #64748b; margin: 16px 0 0; }
@media print {
  .receipt-actions, .test-badge, .form-alert { display: none !important; }
  main.receipt-main { padding: 0; max-width: none; }
}
@media (max-width: 520px) { .receipt dl { grid-template-columns: minmax(0, 1fr); gap: 2px; } .receipt dd { margin-bottom: 8px; } }

/* ---------- Dialogs (upgrade prompt, payment status) ---------- */
.dq-backdrop { position: fixed; inset: 0; z-index: 2000; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; padding: 16px; font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif; }
.dq-dialog { background: #fff; color: #3f3f46; width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow-y: auto; border-radius: 20px; box-shadow: 0 24px 60px rgba(15, 23, 42, .3); padding: 24px; font-size: 15px; line-height: 1.55; }
.dq-dialog:focus { outline: none; }
.dq-dialog h2 { font-size: 20px; line-height: 1.3; font-weight: 800; color: #18181b; margin: 0 0 6px; }
.dq-dialog p { margin: 0 0 12px; }
.dq-reason { color: #52525b; }
.dq-plans { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 8px; }
.dq-plan { display: flex; align-items: center; gap: 12px; border: 1px solid #e2e8f0; border-radius: 14px; padding: 12px 14px; }
.dq-plan .dq-name { flex: 1; min-width: 0; }
.dq-plan b { display: block; color: #18181b; font-size: 15px; }
.dq-plan small { display: block; color: #64748b; font-size: 13px; line-height: 1.4; }
.dq-plan .dq-price { font-weight: 800; color: #18181b; white-space: nowrap; }
.dq-buy { flex: none; height: 36px; padding: 0 14px; border-radius: 10px; border: 0; background: #4f46e5; color: #fff !important; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.dq-buy:hover { background: #4338ca; }
.dq-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.dq-actions > * { flex: 1 1 auto; }
.dq-btn { min-height: 44px; padding: 0 16px; border-radius: 12px; font: inherit; font-size: 14.5px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; cursor: pointer; border: 1px solid #e2e8f0; background: #fff; color: #18181b !important; }
.dq-btn:hover { background: #f8fafc; }
.dq-btn.primary { background: #4f46e5; border-color: #4f46e5; color: #fff !important; }
.dq-btn.primary:hover { background: #4338ca; }
.dq-note { font-size: 13px; color: #64748b; margin-top: 12px !important; }
.dq-status { display: flex; align-items: center; gap: 10px; }
.dq-icon { width: 48px; height: 48px; border-radius: 999px; display: flex; align-items: center; justify-content: center; font-size: 22px; margin: 0 0 10px; background: #eef2ff; color: #4f46e5; }
.dq-icon.ok { background: #ecfdf5; color: #059669; }
.dq-icon.bad { background: #fef2f2; color: #dc2626; }
@media (max-width: 480px) { .dq-dialog { padding: 20px 16px; } .dq-plan { flex-wrap: wrap; row-gap: 6px; } .dq-plan .dq-name { flex-basis: 100%; } .dq-plan .dq-price { flex: 1; } }

/* Sign-up prompts are hidden once js/auth-client.js knows the visitor is signed in. */
html[data-auth="user"] .hide-signed-in { display: none !important; }
