/* Admin panel. Desk work: designed for a computer, survives a phone.
   Loaded after site.css; this file undoes the phone column that site.css gives #app. */

body.admin { font-size: 14px; line-height: 1.45; background: var(--bg); }
.admin #app { max-width: none; padding: 0; margin: 0; }

/* Top bar */
.adminbar { background: var(--navy); color: #fff; }
.adminbar-inner { max-width: 1280px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.adminbrand { display: flex; align-items: center; gap: 12px; }
.adminbrand img { width: 40px; height: 40px; border-radius: 50%; background: #fff; object-fit: contain; }
.adminbrand span { display: flex; flex-direction: column; line-height: 1.15; }
.adminbrand strong { font-size: 16px; }
.adminbrand small { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.adminbar .who { display: flex; align-items: center; gap: 12px; font-size: 13px; opacity: .95; }
.btn.ghost-light { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.25); }
.btn.ghost-light:hover { background: rgba(255,255,255,.22); }

/* Content column */
.admin .shell { max-width: 1280px; margin: 0 auto; padding: 14px 20px 48px; }
.admin h1 { font-size: 20px; margin: 0 0 8px; }
.admin h2 { font-size: 16px; color: var(--navy); margin: 0 0 6px; }
.admin .card { padding: 18px 20px; }
.admin .card + .card { margin-top: 0; }
.admin p { margin: 0 0 8px; }
.admin .field { margin-top: 12px; }
.admin .label { font-size: 13px; margin-bottom: 4px; }
.admin input[type=text], .admin input[type=tel], .admin input[type=email], .admin input[type=password], .admin input[type=search], .admin select, .admin textarea {
  font-size: 14px; padding: 9px 11px; min-height: 40px; border-radius: 8px;
}
.admin textarea { min-height: 80px; }
.admin .btn { font-size: 14px; padding: 9px 16px; min-height: 40px; border-radius: 8px; }
.btn.sm { font-size: 13px; padding: 7px 12px; min-height: 36px; }
.btn.ghost { background: #fff; color: var(--navy); border-color: var(--line); }
.btn.ghost:hover { background: var(--navy-tint); }
.btn.danger { background: #fff; color: var(--amber); border-color: var(--amber-line); }
.btn.danger:hover { background: var(--amber-fill); }
.admin .actions { gap: 8px; margin-top: 12px; }
.admin .actions .btn { flex: 0 0 auto; }
.admin .nav .btn { flex: 0 0 auto; }

/* Tabs */
.tabs { display: flex; gap: 2px; margin: 0 0 16px; border-bottom: 2px solid var(--line); overflow-x: auto; }
.tabs button { font: inherit; font-size: 14px; font-weight: 600; padding: 10px 16px; border: none; border-bottom: 3px solid transparent; margin-bottom: -2px; background: transparent; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--navy); }
.tabs button[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--navy); }
.tabs .badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--amber); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }

/* Toolbars, tables, pager */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.toolbar input[type=search] { width: 320px; max-width: 100%; }
.toolbar select { width: auto; min-width: 160px; }
.toolbar .spacer { flex: 1; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.grid th, table.grid td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #e9edf3; vertical-align: middle; white-space: nowrap; }
table.grid th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #f6f8fb; position: sticky; top: 0; z-index: 1; }
table.grid tbody tr:hover td { background: #fbfcfe; }
table.grid tr:last-child td { border-bottom: none; }
table.grid td.wrap { white-space: normal; max-width: 460px; overflow-wrap: anywhere; }
table.grid input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--navy); }
.flag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--amber-fill); color: var(--amber); border: 1px solid var(--amber-line); white-space: nowrap; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--navy-tint); color: var(--navy); }
.pill.es { background: #eaf3ec; color: var(--green); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; font-size: 13px; color: var(--muted); }
.msg { margin: 10px 0; padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.msg.ok { background: var(--green-fill); color: var(--green); border: 1px solid var(--green); }
.msg.warn { background: var(--amber-fill); color: var(--amber); border: 1px solid var(--amber-line); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: 90vw; margin: 0; }
.hint { font-size: 13px; color: var(--muted); }
.hint.pad { padding: 12px; }
.mt8 { margin-top: 8px; } .mt14 { margin-top: 14px; }

/* Settings and other card grids */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-bottom: 14px; }
.grid2 > .card { margin: 0; }
.grid2 > input { margin: 0; }
.health { font-size: 13px; color: var(--muted); display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.health .on { color: var(--green); font-weight: 700; } .health .off { color: var(--amber); font-weight: 700; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1.5px solid var(--line); border-radius: 8px; font-size: 13px; background: #fff; cursor: pointer; }
.days input { accent-color: var(--navy); }
.admin .card.mt14, .admin > .shell > #pane > .card { margin-bottom: 14px; }

/* Record view dialog */
.overlay .dialog { max-width: 520px; }
.overlay .dialog.wide { max-width: 1000px; max-height: 92vh; overflow-y: auto; }
.kv { display: grid; grid-template-columns: 260px 1fr; gap: 5px 16px; font-size: 13.5px; margin-top: 8px; }
.kv dt { color: var(--navy); font-weight: 700; } .kv dt.sub { color: var(--muted); font-weight: 600; padding-left: 14px; }
.kv dd { margin: 0; white-space: pre-wrap; }
.ssn { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 18px; letter-spacing: .08em; background: #f6f8fb; padding: 3px 8px; border-radius: 6px; }
.imgs { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: 14px; }
.imgs figure { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #f4f6fa; }
.imgs img { width: 100%; max-height: 360px; object-fit: contain; display: block; background: #fff; }
.imgs figcaption { font-size: 12px; color: var(--muted); padding: 6px 8px; }

/* Help chat */
.chatwrap { display: grid; grid-template-columns: 340px 1fr; gap: 14px; }
.chatlist { border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow-y: auto; height: 560px; }
.chatlist button { display: block; width: 100%; text-align: left; font: inherit; padding: 10px 12px; border: none; border-bottom: 1px solid #e9edf3; background: #fff; cursor: pointer; }
.chatlist button:hover { background: #fbfcfe; }
.chatlist button[aria-selected="true"] { background: var(--navy-tint); }
.chatlist .t { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.chatpane { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; background: #fff; height: 560px; }
.chatlog { flex: 1; overflow-y: auto; padding: 14px; background: #f4f6fa; border-radius: 10px 10px 0 0; }
.cm { margin-bottom: 10px; max-width: 72%; } .cm.them { margin-left: auto; }
.cm .w { font-size: 11px; color: var(--muted); font-weight: 700; margin-bottom: 2px; }
.cm .t { padding: 8px 12px; border-radius: 12px; font-size: 14px; white-space: pre-wrap; background: #fff; border: 1px solid #d8dee8; }
.cm.them .t { background: var(--navy); color: #fff; border: none; }
.cm .orig { font-size: 12px; color: var(--muted); margin-top: 3px; font-style: italic; }
.chatfoot { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); align-items: flex-end; }
.chatfoot textarea { flex: 1; min-height: 44px; height: 44px; max-height: 140px; }

/* Form builder */
.steps-table td.title { white-space: normal; font-weight: 600; min-width: 180px; }
.steps-table td.wrap { max-width: 560px; }
.steps-table select { min-width: 110px; }

@media (max-width: 800px) {
  .admin .shell { padding: 12px 14px 40px; }
  .chatwrap { grid-template-columns: 1fr; }
  .chatlist { height: 240px; }
  .kv { grid-template-columns: 1fr; } .kv dt { margin-top: 6px; }
  .toolbar input[type=search] { width: 100%; }
}
