/* Login menu, account area, tickets and live chat. Loaded after styles.css. */

/* ---------- Login menu (header) ---------- */
.btn-outline { background: #fff; color: var(--pink); box-shadow: inset 0 0 0 2px var(--pink); }
.btn-outline:hover { background: #fcebf4; color: var(--pink-dark); }
.site-nav .account { position: relative; margin-left: 12px; }
.site-nav .account .btn { margin: 0; padding: 13px 24px; font-weight: 700; letter-spacing: 0; display: inline-flex; gap: 8px; align-items: center; cursor: pointer; border-bottom: 0; }
.caret { font-size: 11px; }
.account-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: #fff; border-radius: 12px; box-shadow: 0 16px 40px rgba(15, 23, 42, .18); padding: 8px; z-index: 60; display: grid; }
.account-menu[hidden] { display: none; }
.account-who { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; line-height: 1.35; }
.account-who b { display: block; color: var(--ink); }
.account-who span { font-size: 13px; color: var(--pink); }
.site-nav .account-menu a, .account-menu button { display: block; text-align: left; padding: 10px 12px; border-radius: 8px; color: #3f3f3f; text-decoration: none; font: 500 14px/1.3 "Poppins", sans-serif; border: 0; background: none; cursor: pointer; margin: 0; }
.site-nav .account-menu a:hover, .account-menu button:hover { background: #fcebf4; color: var(--pink); }
.account-menu .account-logout { border-top: 1px solid var(--line); margin-top: 6px; border-radius: 0 0 8px 8px; }

/* ---------- Sign-in dialog ---------- */
.auth-tabs { display: flex; gap: 6px; background: var(--bg-alt); padding: 4px; border-radius: 10px; margin-bottom: 24px; }
.auth-tabs button { flex: 1; border: 0; background: none; padding: 10px; border-radius: 8px; font: 600 14px var(--body); color: var(--text); cursor: pointer; }
.auth-tabs button[aria-selected="true"] { background: #fff; color: var(--pink); box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }
.auth-tabs[hidden] { display: none; }
.field input[type="password"] { width: 100%; font: inherit; color: var(--ink); padding: 11px 14px; border: 1px solid #c9ced6; border-radius: 6px; }
.field input[type="password"]:focus { outline: none; border-color: var(--pink); box-shadow: 0 0 0 3px rgba(236, 0, 140, .15); }
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid #c9ced6; border-radius: 10px; padding: 12px; cursor: pointer; font-size: 13px; line-height: 1.4; }
.choice b { display: block; color: var(--ink); font-size: 14px; }
.choice input { accent-color: var(--pink); margin-top: 3px; }
.choice:has(input:checked) { border-color: var(--pink); background: #fff6fb; }
.link-btn { border: 0; background: none; color: var(--pink); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }
.auth-alt { text-align: center; margin: 16px 0 0; font-size: 14px; }
.auth-done { text-align: center; }
.auth-done h2 { margin-bottom: 12px; }

/* ---------- Account area ---------- */
.app-main { background: var(--bg-site); min-height: 60vh; padding: 48px 0 80px; }
.app-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.app-head h1 { font-size: clamp(26px, 3vw, 34px); margin: 0; }
.app-actions { display: flex; gap: 10px; }
.app-loading, .empty { color: var(--muted); }
.panel { background: #fff; border-radius: 16px; padding: 28px; box-shadow: 0 0 40px rgba(0, 0, 0, .06); margin-bottom: 24px; }
.panel h2 { font-size: 20px; margin: 0 0 18px; }
.narrow-panel { max-width: 480px; }
.app-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.app-grid-2 .panel { margin: 0; }
.panel select, .panel textarea, .toolbar select, .toolbar input, .inline-form input, .data-table input, .data-table select, .copy-row input {
  font: inherit; font-size: 14px; color: var(--ink); padding: 9px 12px; border: 1px solid #c9ced6; border-radius: 6px; background: #fff; max-width: 100%; }
.panel textarea { width: 100%; resize: vertical; }
.field select { width: 100%; }
.panel select:focus, .panel textarea:focus, .toolbar input:focus, .data-table input:focus, .data-table select:focus { outline: none; border-color: var(--pink); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; margin: 0 0 20px; font-size: 15px; }
.facts dt { font-weight: 700; color: var(--ink); }
.facts dd { margin: 0; }
.quick-links { display: flex; flex-wrap: wrap; gap: 10px; }
.notice { border-radius: 12px; padding: 14px 18px; margin-bottom: 20px; font-size: 15px; background: #eef6ff; border-left: 4px solid #3b82f6; color: var(--ink); }
.notice-warn { background: #fff4e5; border-left-color: #f59e0b; }
.muted { color: var(--muted); font-size: 13px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-bottom: 14px; font-size: 14px; }
.toolbar label { display: flex; align-items: center; gap: 8px; }
.toolbar input[type="search"] { min-width: 220px; }
.table-scroll { overflow-x: auto; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; background: #fafafa; color: var(--ink); font-weight: 700; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table a { color: var(--pink); text-decoration: none; font-weight: 500; }
.data-table code { font-size: 12px; background: var(--bg-alt); padding: 3px 6px; border-radius: 4px; word-break: break-all; }
.row-actions { display: flex; gap: 8px; }
.activity .act-details { font-size: 13px; max-width: 420px; word-break: break-word; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #eef0f3; color: #475467; white-space: nowrap; }
.badge-open, .badge-new, .badge-active { background: #e7f6ec; color: #067647; }
.badge-in_progress, .badge-contacted, .badge-pending { background: #eef4ff; color: #3538cd; }
.badge-escalated, .badge-urgent, .badge-disabled { background: #fdecef; color: #c01048; }
.badge-high, .badge-internal { background: #fff4e5; color: #b54708; }
.badge-resolved, .badge-customer, .badge-approved, .badge-paid { background: #fcebf4; color: var(--pink-dark); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 100; padding: 12px 22px; border-radius: 10px; color: #fff; background: #067647; font-weight: 500; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); }
.toast-err { background: #d92d20; }
.new-ticket summary { list-style: none; display: inline-block; cursor: pointer; }
.new-ticket summary::-webkit-details-marker { display: none; }
.new-ticket[open] summary { margin-bottom: 20px; }
.new-ticket:not([open]) { background: none; box-shadow: none; padding: 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.copy-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.copy-row input { flex: 1; min-width: 240px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 24px; }
.tile { background: #fff; border-radius: 14px; padding: 20px; box-shadow: 0 0 40px rgba(0, 0, 0, .06); }
.panel .tile { background: var(--bg-alt); box-shadow: none; }
.tile b { display: block; font: 600 30px/1.1 var(--head); color: var(--pink); }
.tile span { font-size: 14px; }

/* Ticket view */
.ticket-layout { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.ticket-layout .panel { margin: 0; }
.ticket-thread { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 14px; }
.ticket-thread li { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.ticket-thread li.mine { background: #fafafa; }
.ticket-thread li.internal { background: #fffaf0; border-color: #fde7c2; }
.ticket-thread header { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; margin-bottom: 6px; color: var(--ink); }
.ticket-thread time { margin-left: auto; font-size: 12px; color: var(--muted); }
.ticket-thread p { margin: 0; white-space: pre-wrap; }
.reply-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 12px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.check input { accent-color: var(--pink); }
.manage { border-top: 1px solid var(--line); padding-top: 18px; display: grid; gap: 4px; }
.manage .btn { margin-top: 6px; }
.ticket-side .back { margin-top: 16px; }

/* Chat inbox */
.chat-inbox { display: grid; grid-template-columns: 320px 1fr; gap: 24px; align-items: start; }
.chat-inbox .panel { margin: 0; }
.chat-list { padding: 8px; max-height: 70vh; overflow-y: auto; }
.chat-list ul { list-style: none; margin: 0; padding: 0; }
.chat-list li a { display: block; padding: 12px; border-radius: 10px; text-decoration: none; color: var(--text); font-size: 14px; line-height: 1.4; }
.chat-list li a span, .chat-list li a time { display: block; font-size: 12px; color: var(--muted); }
.chat-list li.active a, .chat-list li a:hover { background: #fcebf4; }
.chat-list li.unread b::after { content: " \2022"; color: var(--pink); }
.chat-list li.empty { padding: 12px; }
.thread-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; align-items: center; border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 14px; }
.thread-head a { color: var(--pink); font-size: 14px; margin-left: 8px; }
.thread-actions { display: flex; gap: 8px; align-items: center; }
.chat-view .chat-log { border-radius: 12px; max-height: 55vh; }

/* ---------- Live chat bubble ---------- */
.chat-widget { position: fixed; right: 20px; bottom: 20px; z-index: 70; font-size: 14px; }
.chat-bubble { display: flex; align-items: center; gap: 10px; border: 0; border-radius: 999px; background: var(--pink); color: #fff; padding: 14px 20px; font: 700 15px var(--body); cursor: pointer; box-shadow: 0 12px 30px rgba(236, 0, 140, .35); margin-left: auto; }
.chat-bubble svg { width: 20px; height: 20px; fill: #fff; }
.chat-panel { position: absolute; right: 0; bottom: calc(100% + 12px); width: min(360px, calc(100vw - 40px)); background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(15, 23, 42, .25); overflow: hidden; }
.chat-panel[hidden] { display: none; }
.chat-panel header { background: linear-gradient(280deg, #002f41 0%, #49022b 100%); color: #fff; padding: 16px 48px 16px 18px; position: relative; }
.chat-panel header b { display: block; font: 600 16px var(--head); }
.chat-panel header span { font-size: 12px; opacity: .85; }
.chat-close { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .15); color: #fff; font-size: 20px; cursor: pointer; }
.chat-start { display: grid; gap: 10px; padding: 18px; }
.chat-start[hidden], .chat-thread[hidden] { display: none; }
.chat-start input, .chat-start textarea, .chat-send input { font: inherit; padding: 10px 12px; border: 1px solid #c9ced6; border-radius: 8px; width: 100%; }
.chat-start .form-error { margin: 0; }
.chat-log { list-style: none; margin: 0; padding: 16px; display: flex; flex-direction: column; gap: 10px; max-height: 340px; overflow-y: auto; background: #fafafa; }
.chat-log li { max-width: 80%; }
.chat-log li p { margin: 0; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; }
.chat-log li time { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.chat-log li.me { align-self: flex-end; text-align: right; }
.chat-log li.me p { background: var(--pink); color: #fff; border-bottom-right-radius: 4px; }
.chat-log li.them p { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-send { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-send[hidden] { display: none; }
.chat-closed { padding: 12px 16px; margin: 0; font-size: 13px; }
.chat-contact { display: grid; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: #fff6fb; }
.chat-contact[hidden] { display: none; }
.chat-contact p { margin: 0; font-size: 13px; color: var(--ink); }
.chat-contact input { font: inherit; padding: 10px 12px; border: 1px solid #c9ced6; border-radius: 8px; width: 100%; }
.chat-contact input.invalid { border-color: #d92d20; }
.chat-contact .form-error { margin: 0; }
.contact-line { display: flex; flex-wrap: wrap; gap: 4px 0; align-items: center; margin-top: 4px; font-size: 14px; }
.thread-head .contact-line a { margin: 0 12px 0 0; }

@media (max-width: 1240px) {
  .site-nav { gap: 22px; }
}
@media (max-width: 960px) {
  .app-grid-2, .ticket-layout, .chat-inbox { grid-template-columns: 1fr; }
  .site-nav { gap: 16px; }
  .site-nav .account .btn { padding: 11px 16px; }
}
@media (max-width: 760px) {
  .site-nav .account { margin: 10px 0 0; }
  .site-nav .account .btn { width: 100%; justify-content: center; }
  .account-menu { position: static; box-shadow: none; border: 1px solid var(--line); margin-top: 8px; }
  .choice-row { grid-template-columns: 1fr; }
  .chat-bubble span { display: none; }
  .chat-bubble { padding: 16px; }
  .panel { padding: 20px; }
}

.badge-affiliate { background: #fcebf4; color: var(--pink-dark); }
.badge-website { background: #eef0f3; color: #475467; }

/* Contact confirmation (affiliate contacts) */
.badge-confirmed { background: #e7f6ec; color: #067647; }
.badge-awaiting { background: #fff4e5; color: #b54708; }
.badge-declined { background: #fdecef; color: #c01048; }
.declaration { background: var(--bg-alt); border-radius: 10px; padding: 16px; }
.declaration .consent { background: none; padding: 0; margin-bottom: 14px; }
.declaration .field { margin: 0; }
.send-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.send-confirm { margin-top: 20px; padding: 18px; border-radius: 12px; background: #fff6fb; border: 1px solid #f8c9e2; }
.send-confirm h3 { margin: 0 0 6px; font-size: 18px; }
.send-confirm p { margin: 0 0 8px; }
.consent-card { max-width: 640px; margin: 0 auto; }
.consent-card h1 { font-size: 28px; }
.consent-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 12px; }

/* Close-chat window */
.case-fields { margin-top: 18px; }
.case-fields[hidden] { display: none; }
#close-chat .choice-row { margin-bottom: 4px; }
#close-chat .notice { margin: 18px 0 16px; font-size: 14px; }

/* Ticket e-mail history */
.mail-history { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 14px; }
.mail-history h3 { font-size: 15px; margin: 0 0 8px; }
.mail-history ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13px; }
.mail-history li span, .mail-history li time { display: block; color: var(--muted); font-size: 12px; word-break: break-all; }

/* Admin tools: dialogs, lead conversion, company members */
.dialog-done[hidden] { display: none; }
.dialog-done h2 { margin-top: 0; }
.convert-box { background: #fff6fb; border: 1px solid #f8c9e2; border-radius: 10px; padding: 14px 16px; margin: 4px 0 16px; }
.convert-box p { margin: 4px 0 10px; }
.members { margin: 4px 0 16px; font-size: 14px; }
.members ul { margin: 6px 0 0; padding-left: 18px; }
.members li { margin-bottom: 4px; }
.company-pick[hidden] { display: none; }
.app-actions .btn { white-space: nowrap; }
.link-btn[data-edit] { font-weight: 600; text-decoration: none; color: var(--pink); text-align: left; }

/* Chat inbox: latest activity and waiting chats */
.chat-list li a em { display: block; font-style: normal; font-size: 13px; color: var(--text); margin: 4px 0 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-list li.waiting a { border-left: 3px solid #f59e0b; }
.chat-list li.unread a { background: #fff6fb; }
.chat-list li.unread b::after { content: " \2022"; color: var(--pink); font-size: 20px; line-height: 0; }

/* Chat inbox fits the screen: name stays on top, reply box at the bottom, only messages scroll */
@media (min-width: 961px) {
  /* minmax(0, 1fr): the row may not grow with a long conversation (that made it spill over the footer) */
  .chat-inbox { height: calc(100vh - 205px); min-height: 420px; align-items: stretch; grid-template-rows: minmax(0, 1fr); }
  .chat-inbox > .panel { min-height: 0; max-height: none; overflow: hidden; }
  .chat-inbox > .chat-list { overflow-y: auto; height: auto; }
  .chat-list { max-height: none; height: 100%; }
  .chat-view { display: flex; flex-direction: column; height: 100%; padding: 20px 24px; }
  .chat-view .thread-head { flex: none; }
  .chat-view .chat-log { flex: 1; max-height: none; min-height: 0; }
  .chat-view .chat-send, .chat-view > .muted { flex: none; }
  .app-main:has(.chat-inbox) { padding: 24px 0; }
  .app-main:has(.chat-inbox) .app-head { margin-bottom: 14px; }
}
.thread-name { font: 600 20px/1.3 var(--head); color: var(--ink); }
.chat-list li.active a { background: #fcebf4; box-shadow: inset 4px 0 0 var(--pink); }

/* Roles reference and staff "new ticket for a customer" */
.roles-ref summary { cursor: pointer; font-size: 16px; }
.roles-ref[open] summary { margin-bottom: 14px; }
.roles-ref td:first-child { white-space: nowrap; }
.unregistered[hidden] { display: none; }
#staff-ticket .field-row.unregistered { grid-template-columns: 1fr 1fr 1fr; }
.role-info { margin: -6px 0 14px; }
#staff-new:not([open]) + .new-ticket { margin-top: 10px; }

/* Companies list */
.row-inactive td { opacity: .65; }
#company-rows select { min-width: 120px; }

/* Self-service */
.security-grid { align-items: start; }
#team-rows select { min-width: 140px; }

/* Three doors: referral banner, partner page, links in the login window */
.referral-banner { background: #e6f7fe; border-bottom: 1px solid #b8e6fa; }
.referral-banner .container { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; padding-block: 10px; }
.referral-banner span { color: var(--ink); }
.auth-doors { display: grid; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; }
.auth-doors a { color: var(--text); text-decoration: none; }
.auth-doors a b { color: var(--pink); }
.auth-doors a:hover b { text-decoration: underline; }
.mode-note:empty { display: none; }
.customer-only[hidden] { display: none; }
.partner-page .partner-hero { display: grid; gap: 14px; max-width: 760px; margin-bottom: 28px; }
.partner-page .partner-hero h1 { font-size: clamp(34px, 5vw, 52px); margin: 0; }
.partner-page .hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.partner-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; counter-reset: s; }
.partner-steps li { counter-increment: s; display: grid; gap: 4px; padding: 16px; border-radius: 12px; background: var(--bg-alt); }
.partner-steps li::before { content: counter(s); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--pink); color: #fff; font-weight: 700; }
.partner-steps b { font-family: var(--head); color: var(--ink); }
.partner-facts { margin: 0 0 18px; padding-left: 20px; display: grid; gap: 6px; }

/* Referral history tag */
.tag-btn { margin-top: 4px; border: 0; border-radius: 999px; padding: 3px 10px; font: 700 12px var(--body); background: #e6f7fe; color: #007bab; cursor: pointer; }
.tag-btn:hover { background: #cdeffd; }

/* Referral review (several partners) */
.tag-btn.review { background: #fff4e5; color: #b45309; border-color: #f59e0b; }
.review-facts { margin-top: 16px; }
.review-actions { border-top: 1px solid var(--line, #e5e7eb); padding-top: 14px; margin-top: 4px; }
.review-actions .row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
#rates { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
#rates input { width: 130px; }

.referral-banner .referral-actions { display: flex; flex-wrap: wrap; gap: 8px; }


/* Owner only: delete (into the Archive) */
.btn.btn-danger { color: #b91c1c; border-color: #b91c1c; }
.btn.btn-danger:hover { background: #b91c1c; color: #fff; }
.owner-delete { margin: 12px 0 0; text-align: right; }
.act-archive { color: #b91c1c; }
/* Temporary password: a wide box to type your own, with a small "Suggest one" button beside it */
.pw-row { display: flex; gap: 8px; align-items: stretch; }
.pw-row input { flex: 1 1 auto; min-width: 0; width: auto; }
.plans-form .pw-row .btn { flex: 0 0 auto; width: auto; font-size: 14px; white-space: nowrap; }

/* Website Edit */
.toolbar .toolbar-title { margin: 0; font-size: 18px; }
.plans-form textarea[name="text"] { width: 100%; font: inherit; line-height: 1.5; }
