/* ChatApp365 operator UI. */

:root {
	--bg: #f4f6f9;
	--card: #ffffff;
	--fg: #16202c;
	--muted: #6b7684;
	--line: #dfe4ec;
	--accent: #0b5cab;
	--danger: #c5221f;
	--ok: #1a7f37;
	--warn: #a05a00;
	--radius: 10px;
}

* { box-sizing: border-box; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body.centred {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
}

h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 15px; margin: 0 0 12px; }

a { color: var(--accent); }

code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.92em;
	background: #eef1f6;
	padding: 1px 5px;
	border-radius: 4px;
}

pre {
	background: #10161f;
	color: #e6edf3;
	padding: 14px 16px;
	border-radius: var(--radius);
	overflow-x: auto;
	margin: 0 0 12px;
}

pre code { background: none; color: inherit; padding: 0; }

.fine { font-size: 12.5px; color: var(--muted); margin: 4px 0 0; }
.lede { color: var(--muted); margin: 0 0 20px; }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.muted { opacity: 0.55; }

/* ------------------------------------------------------------------ */
/* Chrome                                                              */
/* ------------------------------------------------------------------ */

.topbar {
	display: flex;
	align-items: center;
	gap: 22px;
	padding: 0 22px;
	height: 54px;
	background: #10161f;
	color: #fff;
}

.topbar__brand { color: #fff; font-weight: 700; text-decoration: none; }

.topbar__nav { display: flex; gap: 16px; flex: 1; }

.topbar__nav a {
	color: #c5ced9;
	text-decoration: none;
	font-size: 14px;
	padding: 4px 0;
}

.topbar__nav a:hover { color: #fff; }

.topbar__right { display: flex; align-items: center; gap: 12px; }
.topbar__who { font-size: 13px; color: #9aa7b5; }

.wrap { max-width: 980px; margin: 0 auto; padding: 26px 22px 60px; }
.wrap--wide { max-width: 1500px; }
.card-wrap { width: 100%; max-width: 420px; padding: 20px; }

/* ------------------------------------------------------------------ */
/* Cards, forms                                                        */
/* ------------------------------------------------------------------ */

.card {
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 20px;
	margin-bottom: 18px;
}

.card--narrow { max-width: 420px; }
.card--warn { border-left: 4px solid #dba617; background: #fffaf0; }
.card--embed { background: #f7f9fc; }
.card__title { margin-bottom: 2px; }
.card__sub { color: var(--muted); margin: 0 0 18px; }

.grid { display: grid; gap: 18px; }
.grid--two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

.stack > label { display: block; margin-bottom: 13px; }
.stack > label > span { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 4px; }

.row { display: flex; gap: 12px; }
.row > label { flex: 1; min-width: 0; }
.row--tight { align-items: flex-end; }

input[type="text"], input[type="email"], input[type="password"],
input[type="tel"], input[type="url"], input[type="number"],
input[type="time"], input[type="search"], select, textarea {
	width: 100%;
	padding: 9px 11px;
	border: 1px solid var(--line);
	border-radius: 8px;
	font: inherit;
	background: #fff;
	color: var(--fg);
}

textarea { resize: vertical; }

input:focus, select:focus, textarea:focus {
	outline: 2px solid var(--accent);
	outline-offset: -1px;
	border-color: transparent;
}

input:disabled { background: #f2f4f7; color: var(--muted); }

.check { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.check input { width: auto; }
.check span { font-size: 14px; font-weight: 400; }

.toggle {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-size: 13px;
	padding: 5px 12px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: #fff;
}

hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }

/* Buttons */

.btn {
	display: inline-block;
	padding: 9px 16px;
	border: 1px solid var(--line);
	border-radius: 8px;
	background: #fff;
	color: var(--fg);
	font: inherit;
	font-size: 14px;
	text-decoration: none;
	cursor: pointer;
}

.btn:hover { background: #f4f6f9; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn--danger { color: var(--danger); border-color: #f0c6c5; }
.btn--danger:hover { background: #fdf3f3; }
.btn--quiet { background: transparent; border-color: #2b3644; color: #c5ced9; }
.btn--quiet:hover { background: #1b2430; }
.btn--block { width: 100%; }
.btn--small { padding: 5px 10px; font-size: 13px; }

.inline { display: inline-block; margin: 0 6px 0 0; }

/* Flashes */

.flashes { margin-bottom: 18px; }

.flash {
	padding: 11px 14px;
	border-radius: 8px;
	margin-bottom: 8px;
	font-size: 14px;
}

.flash--success { background: #e7f6ec; color: var(--ok); }
.flash--error { background: #fdecea; color: var(--danger); }
.flash--message { background: #eef1f6; }

/* Tables */

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }

.pill {
	font-size: 11px;
	text-transform: uppercase;
	background: #eef1f6;
	color: var(--muted);
	padding: 1px 6px;
	border-radius: 4px;
}

.codes { columns: 2; font-family: ui-monospace, Menlo, Consolas, monospace; }
.steps > li { margin-bottom: 14px; }
.qr { margin: 10px 0; }

.hours__row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.hours__day { width: 110px; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.hours__row input[type="time"] { width: auto; }

/* Answer editor */

.answer {
	background: var(--card);
	border: 1px solid var(--line);
	border-left-width: 4px;
	border-radius: var(--radius);
	padding: 16px 18px;
	margin-bottom: 14px;
}

.answer--todo { border-left-color: #dba617; background: #fffaf0; }
.answer label { display: block; margin-bottom: 11px; }
.answer label > span { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 4px; }
.answer .row label { margin-bottom: 11px; }

/* ------------------------------------------------------------------ */
/* Inbox                                                               */
/* ------------------------------------------------------------------ */

.inbox-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.inbox-head h1 { margin: 0; }

.inbox {
	display: grid;
	grid-template-columns: 300px minmax(0, 1fr) 270px;
	gap: 16px;
	height: calc(100vh - 160px);
	min-height: 460px;
}

@media (max-width: 1150px) {
	.inbox { grid-template-columns: 260px minmax(0, 1fr); }
	.inbox__meta { display: none; }
}

.inbox__list, .inbox__thread, .inbox__meta {
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	display: flex;
	flex-direction: column;
	min-height: 0;
	overflow: hidden;
}

.inbox__meta { display: block; padding: 16px; overflow-y: auto; }
.inbox__meta dt { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-top: 12px; }
.inbox__meta dd { margin: 2px 0 0; font-size: 13px; overflow-wrap: anywhere; }

.inbox__filters { display: flex; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); }
.inbox__filters select { flex: 0 0 auto; width: auto; }

.inbox__items { margin: 0; padding: 0; list-style: none; overflow-y: auto; flex: 1; }

.inbox__item { padding: 11px 13px; border-bottom: 1px solid #f0f2f5; cursor: pointer; }
.inbox__item:hover { background: #f7f9fc; }
.inbox__item.is-active { background: #eff5fc; box-shadow: inset 3px 0 0 var(--accent); }
.inbox__item.is-unread strong { font-weight: 700; }

.inbox__item-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.inbox__count { background: var(--danger); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.inbox__preview { font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox__item-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 5px; font-size: 11px; color: #8c97a3; }

.flag { padding: 1px 6px; border-radius: 3px; background: #eef1f6; color: #50575e; font-size: 10.5px; text-transform: uppercase; }
.flag--wait { background: #fcf0e4; color: var(--warn); font-weight: 600; }

.inbox__thread-head { padding: 12px 16px; border-bottom: 1px solid var(--line); min-height: 46px; display: flex; align-items: center; }
.inbox__handled { margin-left: 10px; font-size: 11.5px; color: var(--muted); }

.inbox__log { flex: 1; overflow-y: auto; padding: 16px; background: #fbfcfd; }

.placeholder { color: var(--muted); text-align: center; padding: 30px; }

.msg { max-width: 76%; margin-bottom: 12px; }
.msg--visitor { margin-right: auto; }
.msg--agent, .msg--bot { margin-left: auto; text-align: right; }
.msg--system { margin: 10px auto; text-align: center; max-width: 100%; }

.msg__who { font-size: 11px; color: #8c97a3; margin-bottom: 3px; }
.msg__body { display: inline-block; text-align: left; padding: 9px 12px; border-radius: 12px; background: #eef1f6; overflow-wrap: anywhere; }
.msg--agent .msg__body { background: var(--accent); color: #fff; }
.msg--bot .msg__body { background: #e9f2e9; color: #1d3a1d; }
.msg--system .msg__body { background: transparent; font-style: italic; color: var(--muted); font-size: 12.5px; }

.inbox__typing { padding: 0 16px 6px; font-size: 12px; color: var(--muted); font-style: italic; }

.inbox__composer { border-top: 1px solid var(--line); padding: 10px 12px; }
.inbox__actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
