/* Sign-in, dashboard and admin pages. The card itself is styled by card.css; the builder by builder.css. */
:root { --ink: #1f2933; --muted: #5f6b76; --line: #d8dde2; --panel: #fff; --bg: #f2f4f6; --accent: #0b5cad; --accent-dark: #094f95; --danger: #b3261e; --ok: #1d7a3a; --warn: #8a5a00; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.45 system-ui, "Segoe UI", Arial, sans-serif; color: var(--ink); background: var(--bg); min-height: 100vh; }
h1 { font-size: 20px; margin: 0 0 6px; }
h2 { font-size: 16px; margin: 0 0 10px; }
p { margin: 0 0 12px; }
a { color: var(--accent); }
button, select, input, textarea { font: inherit; color: inherit; }
button { padding: 8px 14px; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; }
button:hover { background: #f6f8fa; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { background: var(--accent-dark); }
button.danger { color: var(--danger); }
button.mini { padding: 3px 9px; font-size: 13px; }
button[disabled] { opacity: .5; cursor: default; }
input[type=text], input[type=email], input[type=password], select { width: 100%; padding: 8px 10px; border: 1px solid #b9c2cb; border-radius: 6px; background: #fff; }
textarea { width: 100%; padding: 8px 10px; border: 1px solid #b9c2cb; border-radius: 6px; background: #fff; resize: vertical; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
label { display: block; font-weight: 600; margin: 12px 0 4px; }
.hint, .note { color: var(--muted); font-size: 13px; }
.err { color: var(--danger); }
.ok { color: var(--ok); }
[hidden] { display: none !important; }

/* narrow centred card used for sign-in and set password */
.auth { max-width: 400px; margin: 8vh auto 0; padding: 0 16px; }
.auth .box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 24px 22px; }
.auth button.primary { width: 100%; margin-top: 18px; padding: 10px; }
.auth .links { margin-top: 14px; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.brandline { text-align: center; margin-bottom: 14px; color: var(--muted); font-size: 14px; }
.brandline img { max-width: 220px; max-height: 64px; object-fit: contain; }

/* top bar */
.top { background: var(--panel); border-bottom: 1px solid var(--line); padding: 10px 18px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.top h1 { margin: 0; font-size: 17px; }
.top nav { display: flex; gap: 6px; }
.top nav a { padding: 6px 10px; border-radius: 6px; text-decoration: none; color: var(--ink); }
.top nav a[aria-current=page] { background: #e8f1fb; font-weight: 600; }
.top .spacer { flex: 1; }
.top .who { color: var(--muted); font-size: 14px; }

/* dashboard */
.wrap { max-width: 1200px; margin: 0 auto; padding: 18px; }
.dash { display: grid; grid-template-columns: 260px 1fr; gap: 18px; align-items: start; }
.side { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.side h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 10px 8px 4px; }
.side button { display: flex; width: 100%; justify-content: space-between; gap: 8px; text-align: left; border: 0; background: transparent; padding: 8px; border-radius: 6px; }
.side button[aria-current=true] { background: #e8f1fb; font-weight: 600; }
.side .count { color: var(--muted); font-weight: 400; }
.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.brand-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; text-align: center; font: inherit; color: inherit; }
.brand-tile:hover, .brand-tile:focus-visible { border-color: #3b82c4; box-shadow: 0 2px 10px rgba(0, 0, 0, .08); }
.brand-logo { width: 100%; height: 110px; display: flex; align-items: center; justify-content: center; background: #fff; border-radius: 8px; overflow: hidden; }
.brand-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.brand-logo .lg-dark, :root[data-theme="dark"] .brand-logo.has-dark .lg-light { display: none; }
:root[data-theme="dark"] .brand-logo.has-dark .lg-dark { display: block; }
:root[data-theme="dark"] .brand-logo.has-dark { background: #1f2933; }
.brand-logo.dark-bg { background: #1f2933; }
.brand-logo.noimg { background: #e4e8ec; color: #6b7280; font-weight: 700; font-size: 30px; }
.brand-logo.sm { width: 96px; height: 56px; flex: none; font-size: 20px; }
.brand-name { font-weight: 700; font-size: 16px; }
.brand-meta { color: var(--muted); font-size: 13px; }
.brand-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.brand-head h1 { margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.fchip { display: inline-flex; gap: 8px; align-items: center; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); cursor: pointer; font: inherit; color: inherit; }
.fchip[aria-pressed=true] { background: #e8f1fb; border-color: #3b82c4; font-weight: 600; }
.fchip .count { color: var(--muted); font-weight: 400; }
.logo-edit { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.head .sub { color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; text-align: center; }
.tile img, .tile .noimg { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; margin: 0 auto 10px; display: block; background: #e4e8ec; }
.tile .noimg { display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 26px; color: var(--muted); }
.tile .name { font-weight: 700; font-size: 16px; }
.tile .title { color: var(--muted); font-size: 14px; min-height: 20px; }
.tile .tplname { color: var(--muted); font-size: 13px; }
.tile .meta { margin-top: 8px; font-size: 13px; color: var(--muted); display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.tile .acts { margin-top: 10px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; font-size: 14px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #eef0f3; color: var(--muted); }
.badge.draft { background: #fff3d6; color: var(--warn); }
.empty { background: var(--panel); border: 1px dashed var(--line); border-radius: 10px; padding: 28px; text-align: center; color: var(--muted); }

/* template gallery */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }
.tpl { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; align-items: center; }
.phone { width: 320px; max-width: 100%; height: 560px; border: 8px solid #1f2933; border-radius: 30px; overflow: hidden; background: #fff; }
.phone-frame { display: block; width: 100%; height: 100%; border: 0; }
.page-title { font-size: 28px; line-height: 1.15; }
.tpl-name { margin: 14px 0 6px; font-size: 19px; align-self: stretch; }
.tpl-meta { margin: 0 0 14px; align-self: stretch; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.tpl-meta dt { color: var(--muted); }
.tpl-meta dd { margin: 0; font-weight: 600; }
a.btn { display: inline-block; align-self: stretch; text-align: center; padding: 8px 14px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; }
a.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
a.btn.primary:hover { background: var(--accent-dark); }

/* employees */
.emp { display: grid; grid-template-columns: 260px minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.emp-list { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.emp-list label { margin-top: 0; font-size: 13px; }
.emp-list input[type=text] { margin-bottom: 4px; }
.emp-items { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow: auto; }
.emp-items button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 7px 8px; border-radius: 6px; }
.emp-items button[aria-current=true] { background: #e8f1fb; }
.emp-items .n { display: block; font-weight: 600; }
.emp-items .d { display: block; color: var(--muted); font-size: 12px; }
.emp-edit { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; min-width: 0; }
.emp-edit .note { color: var(--muted); font-size: 13px; }
.emp-edit hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.emp .field { margin-bottom: 8px; }
.emp .field label { font-weight: 400; font-size: 13px; color: var(--muted); margin: 8px 0 3px; }
.emp .row { display: flex; gap: 6px; align-items: center; }
.emp .row > * { min-width: 0; }
.emp .thumb { width: 36px; height: 36px; object-fit: cover; border: 1px solid var(--line); border-radius: 4px; flex: none; background: #eee; }
.emp-phone { position: sticky; top: 12px; text-align: center; }
.emp-phone .phone { margin: 0 auto 8px; }

/* settings */
.settings { max-width: 720px; }
.logo-box { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.logo-preview { flex: none; min-width: 160px; max-width: 260px; min-height: 84px; padding: 10px; border: 1px dashed var(--line); border-radius: 8px; background: #fff; display: flex; align-items: center; justify-content: center; text-align: center; }
.size-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.size-row label { margin: 0; font-weight: 400; }
.size-row select { width: auto; }
.size-row input[type=number] { width: 80px; padding: 8px 10px; border: 1px solid #b9c2cb; border-radius: 6px; background: #fff; }
.logo-preview.dark { background: #1b232b; border-color: #33404b; }
.logo-preview.dark .hint { color: #9aa7b2; }
.logo-preview img { max-width: 100%; object-fit: contain; }
.logo-preview .hint { color: #5f6b76; }
.logo-box > div:last-child { flex: 1; min-width: 220px; }

/* admin */
.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; padding: 9px 14px; }
.tabs button[aria-selected=true] { border-bottom-color: var(--accent); font-weight: 600; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
td.acts { white-space: nowrap; text-align: right; }
.formrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; align-items: end; }
.formrow label { margin-top: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 4px; }
.checks label { font-weight: 400; margin: 0; display: flex; gap: 6px; align-items: center; }
.checks input { width: auto; }
.formmsg { margin-left: 12px; font-weight: 600; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #eef0f3; margin: 1px 3px 1px 0; }
.chip.active { background: #dff3e5; color: var(--ok); }
.chip.invited { background: #fff3d6; color: var(--warn); }
.chip.inactive { background: #f9dedc; color: var(--danger); }
.linkbox { margin-top: 10px; padding: 10px; background: #f6f8fa; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; word-break: break-all; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #1f2933; color: #fff; padding: 9px 16px; border-radius: 8px; max-width: 90vw; z-index: 30; }
.toast.err { background: var(--danger); color: #fff; }
dialog { border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px; width: min(380px, 92vw); }
dialog::backdrop { background: rgba(0, 0, 0, .35); }

@media (max-width: 800px) {
  .dash { grid-template-columns: 1fr; }
  .emp { grid-template-columns: 1fr; }
  .emp-phone { position: static; }
  .wrap { padding: 12px; }
  table, thead, tbody, tr, th, td { display: block; }
  thead { display: none; }
  tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  td { border: 0; padding: 3px 0; }
  td.acts { text-align: left; }
}
