/* =========================================================================
   Agri Helpdesk – portal styles
   One accent colour (Settings → Brand colour), neutral slate palette.
   ========================================================================= */

.ahd {
	--ahd-accent: #5f7f00;
	--ahd-accent-soft: color-mix(in srgb, var(--ahd-accent) 10%, #fff);
	--ahd-accent-line: color-mix(in srgb, var(--ahd-accent) 35%, #fff);
	--ahd-accent-dark: color-mix(in srgb, var(--ahd-accent) 80%, #000);
	--ahd-ink: #0f172a;
	--ahd-text: #334155;
	--ahd-muted: #64748b;
	--ahd-faint: #94a3b8;
	--ahd-line: #e2e8f0;
	--ahd-line-strong: #cbd5e1;
	--ahd-bg: #f8fafc;
	--ahd-card: #fff;
	--ahd-danger: #dc2626;
	--ahd-radius: 12px;
	--ahd-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
	--ahd-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

	font-family: var(--ahd-font);
	font-size: 15px;
	line-height: 1.5;
	color: var(--ahd-text);
	max-width: 1240px;
	margin: 0 auto;
	-webkit-font-smoothing: antialiased;
}
.ahd *, .ahd *::before, .ahd *::after { box-sizing: border-box; }
.ahd a { color: var(--ahd-accent-dark); text-decoration: none; }
.ahd a:hover { text-decoration: underline; }
.ahd h1, .ahd h2, .ahd h3 { font-family: var(--ahd-font); color: var(--ahd-ink); letter-spacing: -.01em; margin: 0; }
.ahd p { margin: 0 0 .75em; }
.ahd code { font-size: 12px; background: var(--ahd-bg); padding: 1px 5px; border-radius: 4px; }
.ahd-ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ahd-muted { color: var(--ahd-faint); }
.ahd-sub { color: var(--ahd-muted); font-size: 14px; margin: 4px 0 0; }
.ahd-help { display: block; color: var(--ahd-muted); font-size: 13px; margin: 2px 0 6px; }
.ahd-req { color: var(--ahd-danger); }
.ahd-grow { flex: 1; }
.ahd-mono { font-variant-numeric: tabular-nums; }
.ahd-nowrap { white-space: nowrap; }
.ahd-mt { margin-top: 28px; }

/* Hide the theme's page title on the portal page (the portal has its own headings). */
.ahd-portal-page .entry-header, .ahd-portal-page .page-header, .ahd-portal-page h1.entry-title, .ahd-portal-page .wp-block-post-title { display: none; }

/* ---------- Buttons ---------- */
.ahd .ahd-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid transparent;
	font: 600 14px/1 var(--ahd-font); text-decoration: none; cursor: pointer; white-space: nowrap;
	transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
	background: var(--ahd-card); color: var(--ahd-ink); box-shadow: none; text-transform: none; letter-spacing: 0;
}
.ahd .ahd-btn:hover { text-decoration: none; }
.ahd .ahd-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ahd-accent-line); }
.ahd .ahd-btn-primary { background: var(--ahd-accent); color: #fff; }
.ahd .ahd-btn-primary:hover { background: var(--ahd-accent-dark); color: #fff; }
.ahd .ahd-btn-dark { background: var(--ahd-ink); color: #fff; }
.ahd .ahd-btn-dark:hover { background: #1e293b; color: #fff; }
.ahd .ahd-btn-outline { border-color: var(--ahd-line-strong); color: var(--ahd-ink); }
.ahd .ahd-btn-outline:hover { border-color: var(--ahd-ink); background: var(--ahd-card); color: var(--ahd-ink); }
.ahd .ahd-btn-ghost { background: transparent; color: var(--ahd-text); }
.ahd .ahd-btn-ghost:hover { background: #f1f5f9; color: var(--ahd-ink); }
.ahd .ahd-btn-success { background: #15803d; color: #fff; }
.ahd .ahd-btn-success:hover { background: #166534; color: #fff; }
.ahd .ahd-btn-lg { height: 48px; padding: 0 28px; font-size: 15px; }
.ahd .ahd-btn-block { width: 100%; }
.ahd .ahd-btn[disabled] { opacity: .6; cursor: progress; }

/* ---------- Top bar ---------- */
.ahd-topbar {
	display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
	background: var(--ahd-card); border: 1px solid var(--ahd-line); border-radius: var(--ahd-radius);
	padding: 12px 16px 12px 20px; margin: 0 0 24px; box-shadow: var(--ahd-shadow);
}
.ahd .ahd-brand { font-weight: 700; font-size: 17px; color: var(--ahd-ink); letter-spacing: -.01em; display: inline-flex; align-items: center; gap: 10px; }
.ahd .ahd-brand::before { content: ""; width: 10px; height: 22px; border-radius: 3px; background: var(--ahd-accent); }
.ahd .ahd-brand:hover { text-decoration: none; }
.ahd-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.ahd .ahd-navlink { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 8px; color: var(--ahd-muted); font-weight: 600; font-size: 14px; }
.ahd .ahd-navlink:hover { background: #f1f5f9; color: var(--ahd-ink); text-decoration: none; }
.ahd .ahd-navlink.is-active { background: var(--ahd-accent-soft); color: var(--ahd-accent-dark); }
.ahd .ahd-navlink .ahd-ico { width: 16px; height: 16px; }
.ahd-user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.ahd .ahd-userchip { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 999px; color: var(--ahd-ink); }
.ahd .ahd-userchip:hover, .ahd .ahd-userchip.is-active { background: #f1f5f9; text-decoration: none; }
.ahd-userinfo { display: flex; flex-direction: column; line-height: 1.2; }
.ahd-username { font-weight: 600; font-size: 14px; }
.ahd-userrole { font-size: 12px; color: var(--ahd-muted); }
.ahd-avatar {
	width: 34px; height: 34px; border-radius: 50%; flex: none;
	display: inline-flex; align-items: center; justify-content: center;
	background: #e2e8f0; color: var(--ahd-ink); font-weight: 700; font-size: 13px;
}
.ahd-avatar-staff { background: var(--ahd-accent); color: #fff; }
.ahd-avatar-lg { width: 64px; height: 64px; font-size: 22px; }

/* ---------- Page heads, notices, cards ---------- */
.ahd-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 0 0 20px; }
.ahd .ahd-h1 { font-size: 26px; font-weight: 700; line-height: 1.25; }
.ahd-notice { padding: 12px 16px; border-radius: 10px; margin: 0 0 20px; font-size: 14px; border: 1px solid; }
.ahd-notice-ok { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.ahd-notice-err { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.ahd-notice-info { background: #f8fafc; border-color: var(--ahd-line); color: var(--ahd-text); }
.ahd-card { background: var(--ahd-card); border: 1px solid var(--ahd-line); border-radius: var(--ahd-radius); padding: 24px; margin: 0 0 20px; box-shadow: var(--ahd-shadow); }
.ahd-card-head { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; }
.ahd .ahd-card-head h2 { font-size: 17px; font-weight: 700; }
.ahd-num { width: 28px; height: 28px; border-radius: 50%; background: var(--ahd-ink); color: #fff; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ahd-count { display: inline-flex; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: #f1f5f9; color: var(--ahd-muted); font-size: 12px; font-weight: 600; align-items: center; justify-content: center; margin-left: 6px; }
.ahd-form-foot { display: flex; justify-content: flex-end; margin-top: 20px; }

/* ---------- Form controls ---------- */
.ahd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; align-items: start; }
.ahd-wide { grid-column: 1 / -1; }
.ahd-field { min-width: 0; margin: 0; }
.ahd .ahd-label { display: block; font-weight: 600; font-size: 14px; color: var(--ahd-ink); margin: 0 0 6px; padding: 0; }
.ahd fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.ahd input[type=text], .ahd input[type=email], .ahd input[type=number], .ahd input[type=date], .ahd input[type=tel], .ahd input[type=url],
.ahd input[type=password], .ahd input[type=search], .ahd select, .ahd textarea {
	width: 100%; height: 44px; padding: 0 12px; margin: 0;
	border: 1px solid var(--ahd-line-strong); border-radius: 8px; background: #fff;
	font: 400 15px/1.4 var(--ahd-font); color: var(--ahd-ink); box-shadow: none;
	transition: border-color .15s, box-shadow .15s;
}
.ahd textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; }
.ahd select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
	background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 16px; }
.ahd input:focus, .ahd select:focus, .ahd textarea:focus { outline: none; border-color: var(--ahd-accent); box-shadow: 0 0 0 3px var(--ahd-accent-line); }
.ahd input[disabled] { background: var(--ahd-bg); color: var(--ahd-muted); }
.ahd input::placeholder, .ahd textarea::placeholder { color: var(--ahd-faint); }
.has-error input, .has-error select, .has-error textarea, .has-error .ahd-drop { border-color: var(--ahd-danger) !important; }
.ahd-error { display: block; color: var(--ahd-danger); font-size: 13px; font-weight: 500; margin-top: 6px; }
.ahd-step-card.has-error { border-color: #fecaca; }

/* Choice buttons (radio / checkbox) */
.ahd-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.ahd .ahd-choice { position: relative; display: inline-flex; margin: 0; cursor: pointer; }
.ahd .ahd-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ahd-choice span {
	display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 14px;
	border: 1px solid var(--ahd-line-strong); border-radius: 8px; background: #fff;
	font-size: 14px; font-weight: 500; color: var(--ahd-text); transition: all .15s;
}
.ahd-choice span::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--ahd-line-strong); flex: none; transition: all .15s; }
.ahd-choice input[type=checkbox] + span::before { border-radius: 4px; }
.ahd-choice:hover span { border-color: var(--ahd-faint); }
.ahd-choice input:checked + span { border-color: var(--ahd-accent); background: var(--ahd-accent-soft); color: var(--ahd-ink); }
.ahd-choice input:checked + span::before { border-color: var(--ahd-accent); background: var(--ahd-accent); box-shadow: inset 0 0 0 2.5px #fff; }
.ahd-choice input:focus-visible + span { box-shadow: 0 0 0 3px var(--ahd-accent-line); }
.ahd .ahd-check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; margin: 0; }
.ahd .ahd-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--ahd-accent); }

/* Sections inside a category */
.ahd-section-title { display: flex; align-items: center; gap: 12px; margin: 14px 0 -4px; }
.ahd-section-title span { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ahd-accent-dark); white-space: nowrap; }
.ahd-section-title::after { content: ""; height: 1px; background: var(--ahd-line); flex: 1; }
.ahd-branch.ahd-wide > .ahd-grid { padding: 16px 0 0 18px; border-left: 2px solid var(--ahd-accent-line); }
.ahd-branch[data-for="category"] > .ahd-grid { margin-top: 18px; }

/* ---------- New ticket ---------- */
.ahd-ticket-form { max-width: 920px; }
.ahd-profile { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 16px 0 0; padding: 16px; background: var(--ahd-bg); border-radius: 10px; }
.ahd-profile dt { font-size: 12px; color: var(--ahd-muted); margin: 0; }
.ahd-profile dd { margin: 2px 0 0; font-weight: 600; color: var(--ahd-ink); word-break: break-word; }
.ahd .ahd-step-card .ahd-grid + .ahd-profile { margin-top: 16px; }
.ahd-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.ahd .ahd-tile { position: relative; display: block; margin: 0; cursor: pointer; }
.ahd .ahd-tile input { position: absolute; opacity: 0; }
.ahd-tile-body {
	display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 16px 16px 16px 46px;
	border: 1.5px solid var(--ahd-line); border-radius: 10px; background: #fff; transition: all .15s; position: relative;
}
.ahd-tile-body::before { content: ""; position: absolute; left: 16px; top: 18px; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--ahd-line-strong); transition: all .15s; }
.ahd-tile:hover .ahd-tile-body { border-color: var(--ahd-faint); }
.ahd-tile input:checked + .ahd-tile-body { border-color: var(--ahd-accent); background: var(--ahd-accent-soft); }
.ahd-tile input:checked + .ahd-tile-body::before { border-color: var(--ahd-accent); background: var(--ahd-accent); box-shadow: inset 0 0 0 3px #fff; }
.ahd-tile input:focus-visible + .ahd-tile-body { box-shadow: 0 0 0 3px var(--ahd-accent-line); }
.ahd-tile-title { font-weight: 700; color: var(--ahd-ink); }
.ahd-tile-desc { font-size: 13px; color: var(--ahd-muted); line-height: 1.4; }
.ahd-submit-bar { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 4px 0 24px; }

/* Code search */
.ahd-combo { position: relative; }
.ahd-combo-list {
	position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; margin: 0; padding: 6px; list-style: none;
	background: #fff; border: 1px solid var(--ahd-line); border-radius: 10px; box-shadow: 0 12px 32px rgba(15, 23, 42, .14);
	max-height: 300px; overflow-y: auto;
}
.ahd-combo-list li { display: flex; gap: 12px; padding: 9px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; color: var(--ahd-text); }
.ahd-combo-list li b { font-variant-numeric: tabular-nums; color: var(--ahd-ink); min-width: 40px; }
.ahd-combo-list li:hover, .ahd-combo-list li.is-active { background: var(--ahd-accent-soft); }
.ahd-combo-list li.ahd-none { color: var(--ahd-muted); cursor: default; background: none; }

/* Upload zone */
.ahd-drop {
	display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 20px 16px;
	border: 1.5px dashed var(--ahd-line-strong); border-radius: 10px; background: var(--ahd-bg);
	text-align: center; cursor: pointer; transition: all .15s;
}
.ahd-drop:hover, .ahd-drop:focus-visible, .ahd-drop.is-over { border-color: var(--ahd-accent); background: var(--ahd-accent-soft); outline: none; }
.ahd-drop-icon svg { width: 26px; height: 26px; fill: none; stroke: var(--ahd-accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ahd-drop-title { font-size: 14px; color: var(--ahd-text); }
.ahd-drop-title strong { color: var(--ahd-accent-dark); }
.ahd-drop-hint { font-size: 12px; color: var(--ahd-muted); }
.ahd-filelist { list-style: none; margin: 8px 0 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 6px; }
.ahd-filelist:empty { display: none; }
.ahd-filelist li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: #fff; border: 1px solid var(--ahd-line); border-radius: 8px; font-size: 13px; text-align: left; }
.ahd-fl-name { flex: 1; font-weight: 500; color: var(--ahd-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ahd-fl-size { color: var(--ahd-muted); }
.ahd .ahd-fl-del { background: none; border: 0; padding: 2px 6px; cursor: pointer; color: var(--ahd-muted); font-size: 13px; border-radius: 4px; }
.ahd .ahd-fl-del:hover { color: var(--ahd-danger); background: #fef2f2; }

/* ---------- Dashboard ---------- */
.ahd-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 0 0 16px; }
.ahd .ahd-stat {
	display: flex; flex-direction: column; gap: 2px; padding: 16px 18px;
	background: var(--ahd-card); border: 1px solid var(--ahd-line); border-radius: var(--ahd-radius); box-shadow: var(--ahd-shadow);
	color: var(--ahd-text); position: relative; overflow: hidden; transition: border-color .15s, transform .15s;
}
.ahd .ahd-stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c, var(--ahd-line)); }
.ahd .ahd-stat:hover { text-decoration: none; border-color: var(--ahd-line-strong); }
.ahd .ahd-stat.is-on { border-color: var(--c); box-shadow: 0 0 0 1px var(--c); }
.ahd-stat-n { font-size: 28px; font-weight: 700; color: var(--ahd-ink); line-height: 1.1; font-variant-numeric: tabular-nums; }
.ahd-stat-l { font-size: 13px; font-weight: 500; color: var(--ahd-muted); }
.ahd-stat-escalated { --c: #ea580c; }
.ahd-stat-in_progress { --c: #2563eb; }
.ahd-stat-feedback_dealer { --c: #7c3aed; }
.ahd-stat-manufacturer { --c: #0e7490; }
.ahd-stat-closed { --c: #16a34a; }

.ahd-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 16px; }
.ahd-filters > input, .ahd-filters > select { width: auto; flex: 1 1 150px; max-width: 220px; height: 40px; font-size: 14px; }
.ahd .ahd-search { position: relative; flex: 2 1 260px; margin: 0; }
.ahd .ahd-search .ahd-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ahd-faint); width: 16px; height: 16px; }
.ahd .ahd-search input { padding-left: 36px; height: 40px; font-size: 14px; }

.ahd-table-card { padding: 0; overflow: hidden; }
.ahd-table-wrap { overflow-x: auto; }
.ahd .ahd-table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 0; border: 0; }
.ahd .ahd-table th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ahd-muted); background: var(--ahd-bg); padding: 12px 16px; border: 0; border-bottom: 1px solid var(--ahd-line); white-space: nowrap; }
.ahd .ahd-table td { padding: 14px 16px; border: 0; border-bottom: 1px solid #f1f5f9; vertical-align: middle; color: var(--ahd-text); }
.ahd .ahd-table tbody tr:last-child td { border-bottom: 0; }
.ahd .ahd-table tbody tr[data-href] { cursor: pointer; transition: background-color .12s; }
.ahd .ahd-table tbody tr[data-href]:hover td { background: #f8fafc; }
.ahd-td-num a { font-weight: 700; color: var(--ahd-ink); font-variant-numeric: tabular-nums; }
.ahd-td-subject { min-width: 240px; }
.ahd-td-subject a { color: var(--ahd-ink); font-weight: 600; }
.ahd-td-sub { display: block; font-size: 12px; color: var(--ahd-muted); margin-top: 2px; }
.ahd-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 40px 16px; color: var(--ahd-muted); }
.ahd-empty strong { color: var(--ahd-ink); }
.ahd-pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--ahd-line); font-size: 13px; color: var(--ahd-muted); }

/* Status & priority */
.ahd-pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: #f1f5f9; color: var(--ahd-text); }
.ahd-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ahd-st-escalated { background: #fff7ed; color: #c2410c; }
.ahd-st-in_progress { background: #eff6ff; color: #1d4ed8; }
.ahd-st-feedback_dealer { background: #f5f3ff; color: #6d28d9; }
.ahd-st-manufacturer { background: #ecfeff; color: #0e7490; }
.ahd-st-closed { background: #f0fdf4; color: #15803d; }
.ahd-pill-dark { background: var(--ahd-ink); color: #fff; }
.ahd-prio { font-size: 13px; font-weight: 600; }
.ahd-prio-high { color: #dc2626; }
.ahd-prio-medium { color: #d97706; }
.ahd-prio-low { color: var(--ahd-muted); }

/* ---------- Ticket page ---------- */
.ahd .ahd-back { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; color: var(--ahd-muted); margin: 0 0 12px; }
.ahd .ahd-back .ahd-ico { width: 16px; height: 16px; }
.ahd-ticket-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 0 0 20px; }
.ahd-ticket-meta { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; flex-wrap: wrap; }
.ahd-ticket-num { font-weight: 700; color: var(--ahd-muted); font-variant-numeric: tabular-nums; }
.ahd-ticket-actions { display: flex; gap: 8px; }
.ahd-ticket-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.ahd-ticket-side { position: sticky; top: 20px; }

.ahd-answers { margin: 0; }
.ahd-ans { display: grid; grid-template-columns: minmax(180px, 38%) 1fr; gap: 16px; padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.ahd-ans:last-child { border-bottom: 0; }
.ahd-ans dt { color: var(--ahd-muted); font-size: 14px; }
.ahd-ans dd { margin: 0; color: var(--ahd-ink); font-weight: 500; word-break: break-word; }
.ahd-ans-sub dt { padding-left: 14px; border-left: 2px solid var(--ahd-accent-line); }
.ahd-ans-head { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ahd-accent-dark); margin: 20px 0 4px; }
.ahd-ans-head:first-child { margin-top: 0; }

.ahd-thread { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.ahd-msg { display: flex; gap: 12px; margin: 0; }
.ahd-msg-box { flex: 1; min-width: 0; border: 1px solid var(--ahd-line); border-radius: 10px; padding: 12px 16px; background: #fff; }
.ahd-msg-staff .ahd-msg-box { background: var(--ahd-accent-soft); border-color: var(--ahd-accent-line); }
.ahd-msg-internal .ahd-msg-box { background: #fffbeb; border: 1px dashed #f59e0b; }
.ahd-msg-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 6px; font-size: 14px; }
.ahd-msg-head strong { color: var(--ahd-ink); }
.ahd-msg-head time { margin-left: auto; font-size: 12px; color: var(--ahd-muted); }
.ahd-msg-body { color: var(--ahd-text); word-break: break-word; }
.ahd-tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--ahd-accent); color: #fff; }
.ahd-tag-dealer { background: #e2e8f0; color: var(--ahd-text); }
.ahd-tag-internal { background: #f59e0b; color: #fff; }
.ahd-event { display: flex; justify-content: center; gap: 8px; font-size: 12px; color: var(--ahd-muted); padding: 0 0 0 46px; margin: 0; }
.ahd-event span { background: var(--ahd-bg); border: 1px solid var(--ahd-line); border-radius: 999px; padding: 3px 12px; }
.ahd-event time { align-self: center; }

.ahd-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ahd .ahd-file { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 6px 10px 6px 6px; border: 1px solid var(--ahd-line); border-radius: 8px; background: #fff; color: var(--ahd-ink); font-size: 13px; }
.ahd .ahd-file:hover { border-color: var(--ahd-faint); text-decoration: none; }
.ahd-file-ext { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 28px; padding: 0 4px; border-radius: 6px; background: var(--ahd-ink); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .03em; }
.ahd-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; font-weight: 500; }
.ahd-file-size { color: var(--ahd-muted); font-size: 12px; }
.ahd .ahd-file-img { padding: 0; overflow: hidden; }
.ahd-file-img img { display: block; width: 96px; height: 72px; object-fit: cover; }

.ahd-reply { border-top: 1px solid var(--ahd-line); padding-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.ahd-reply .ahd-drop { padding: 12px; flex-direction: row; justify-content: center; gap: 10px; flex-wrap: wrap; }
.ahd-reply .ahd-drop-icon svg { width: 20px; height: 20px; }
.ahd-reply-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ahd-accept { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 16px; padding: 14px 16px; border: 1px solid #bbf7d0; background: #f0fdf4; border-radius: 10px; }
.ahd-accept strong { display: block; color: #14532d; }
.ahd-accept .ahd-sub { margin: 0; }

.ahd-kv { margin: 0; }
.ahd-kv > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid #f1f5f9; font-size: 14px; }
.ahd-kv > div:last-child { border-bottom: 0; }
.ahd-kv dt { color: var(--ahd-muted); }
.ahd-kv dd { margin: 0; color: var(--ahd-ink); font-weight: 500; text-align: right; word-break: break-word; }
.ahd-manage { border-top: 3px solid var(--ahd-accent); }
.ahd-manage .ahd-field { margin-bottom: 14px; }
.ahd-manage .ahd-help { margin-top: 12px; }
.ahd-filelinks { list-style: none; margin: 0; padding: 0; }
.ahd-filelinks li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.ahd-filelinks li:last-child { border-bottom: 0; }
.ahd-filelinks a { display: inline-flex; align-items: center; gap: 6px; min-width: 0; color: var(--ahd-ink); font-weight: 500; }
.ahd-filelinks a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ahd-filelinks .ahd-ico { width: 15px; height: 15px; color: var(--ahd-muted); }
.ahd-filelinks small { color: var(--ahd-muted); white-space: nowrap; }

/* ---------- Account ---------- */
.ahd-account { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; align-items: start; }
.ahd-account-card { display: flex; flex-direction: column; align-items: center; text-align: center; }
.ahd-account-card .ahd-kv { width: 100%; margin: 16px 0; text-align: left; }
.ahd-account-name { font-size: 18px; font-weight: 700; color: var(--ahd-ink); margin-top: 12px; }
.ahd-mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-bottom: 16px; }
.ahd .ahd-mini-stats a { display: flex; flex-direction: column; padding: 12px; background: var(--ahd-bg); border-radius: 10px; color: var(--ahd-muted); font-size: 12px; }
.ahd .ahd-mini-stats a:hover { text-decoration: none; background: var(--ahd-accent-soft); }
.ahd-mini-stats strong { font-size: 22px; color: var(--ahd-ink); }

/* ---------- Login ---------- */
.ahd-login { display: flex; justify-content: center; padding: 48px 16px; }
.ahd-login-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--ahd-line); border-radius: 16px; padding: 36px; box-shadow: 0 10px 40px rgba(15, 23, 42, .08); }
.ahd .ahd-brand-lg { font-size: 15px; margin-bottom: 28px; }
.ahd-login-card .ahd-h1 { font-size: 24px; }
.ahd-login-card form { margin: 24px 0 0; }
.ahd-login-card form p { margin: 0 0 16px; }
.ahd-login-card label { display: block; font-weight: 600; font-size: 14px; color: var(--ahd-ink); margin-bottom: 6px; }
.ahd-login-card .login-remember label { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ahd-text); }
.ahd-login-card .login-remember input { accent-color: var(--ahd-accent); }
.ahd-login-card .login-submit input[type=submit], .ahd-login-card #wp-submit {
	width: 100%; height: 48px; border: 0; border-radius: 8px; background: var(--ahd-accent); color: #fff;
	font: 600 15px var(--ahd-font); cursor: pointer; transition: background-color .15s;
}
.ahd-login-card #wp-submit:hover { background: var(--ahd-accent-dark); }
.ahd-login-foot { display: flex; flex-direction: column; gap: 6px; align-items: center; margin: 20px 0 0 !important; font-size: 13px; color: var(--ahd-muted); }

/* ---------- Form setup & settings ---------- */
.ahd-builder-bar { display: flex; align-items: center; gap: 12px; margin: 16px 0; }
.ahd-adv { margin: 8px 0 20px; font-size: 14px; }
.ahd-adv summary { cursor: pointer; color: var(--ahd-muted); }
.ahd-adv textarea { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; margin: 8px 0; }
.ahd-undo { margin: 0 0 20px; }
.ahd-b-cat { background: #fff; border: 1px solid var(--ahd-line); border-radius: var(--ahd-radius); padding: 14px 16px; margin: 0 0 12px; box-shadow: var(--ahd-shadow); }
.ahd-b-cat.is-open { border-color: var(--ahd-accent-line); }
.ahd-b-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ahd .ahd-b-row input[type=text] { flex: 1 1 240px; height: 38px; font-size: 14px; }
.ahd .ahd-b-row select { width: auto; height: 38px; font-size: 13px; max-width: 100%; }
.ahd .ahd-b-catname { font-weight: 700; }
.ahd .ahd-b-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ahd-text); white-space: nowrap; margin: 0; }
.ahd .ahd-b-check input { accent-color: var(--ahd-accent); width: 15px; height: 15px; margin: 0; }
.ahd-b-tools { display: inline-flex; gap: 4px; }
.ahd .ahd-b-icon, .ahd .ahd-b-toggle { width: 32px; height: 32px; padding: 0; border: 1px solid var(--ahd-line); border-radius: 6px; background: #fff; color: var(--ahd-muted); cursor: pointer; font-size: 14px; line-height: 1; }
.ahd .ahd-b-icon:hover, .ahd .ahd-b-toggle:hover { border-color: var(--ahd-faint); color: var(--ahd-ink); }
.ahd .ahd-b-del:hover { color: var(--ahd-danger); border-color: #fecaca; }
.ahd .ahd-b-toggle { font-size: 18px; transition: transform .15s; }
.ahd .ahd-b-toggle.is-open { transform: rotate(90deg); }
.ahd-b-body { padding: 12px 0 0 40px; }
.ahd .ahd-b-small { display: block; font-size: 13px; color: var(--ahd-muted); margin: 8px 0; font-weight: 500; }
.ahd .ahd-b-small input, .ahd .ahd-b-small select { margin-top: 4px; height: 38px; font-size: 14px; }
.ahd-b-fields { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.ahd-b-q { border: 1px solid var(--ahd-line); border-radius: 10px; padding: 8px 10px; background: var(--ahd-bg); }
.ahd-b-q-sub { background: #fff; }
.ahd-b-heading { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-left: 3px solid var(--ahd-accent); background: var(--ahd-accent-soft); border-radius: 6px; }
.ahd .ahd-b-heading input[type=text] { flex: 1; height: 34px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; font-size: 12px; }
.ahd-b-badge { font-size: 11px; font-weight: 700; color: var(--ahd-accent-dark); text-transform: uppercase; }
.ahd-b-options { margin-top: 6px; padding-left: 12px; border-left: 2px solid var(--ahd-accent-line); }
.ahd-b-opt { margin: 6px 0; }
.ahd .ahd-b-link { background: none; border: 0; padding: 4px 0; color: var(--ahd-accent-dark); font-size: 13px; font-weight: 500; cursor: pointer; text-align: left; }
.ahd-b-addrow { display: flex; gap: 8px; }
.ahd .ahd-b-add { background: none; border: 1px dashed var(--ahd-line-strong); border-radius: 8px; padding: 6px 12px; font: 600 13px var(--ahd-font); color: var(--ahd-text); cursor: pointer; }
.ahd .ahd-b-add:hover { border-color: var(--ahd-accent); color: var(--ahd-accent-dark); }
.ahd-b-summary { font-size: 13px; color: var(--ahd-muted); margin: 4px 0 0 40px; }
.ahd-color { display: flex; align-items: center; gap: 10px; }
.ahd .ahd-color input[type=color] { width: 52px; height: 44px; padding: 4px; border: 1px solid var(--ahd-line-strong); border-radius: 8px; background: #fff; cursor: pointer; }
.ahd-codes-card { border: 1px solid var(--ahd-line); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.ahd-codes-head { display: flex; align-items: center; justify-content: space-between; }
.ahd-codes-card input[type=file] { font-size: 13px; }
.ahd-row-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
	.ahd-ticket-grid, .ahd-account { grid-template-columns: 1fr; }
	.ahd-ticket-side { position: static; }
	.ahd-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
	.ahd { font-size: 14px; }
	.ahd-card { padding: 18px 16px; }
	.ahd-grid { grid-template-columns: 1fr; }
	.ahd-topbar { gap: 12px; padding: 12px; }
	.ahd-user { margin-left: 0; width: 100%; justify-content: space-between; }
	.ahd-nav { width: 100%; }
	.ahd .ahd-h1 { font-size: 22px; }
	.ahd-ans { grid-template-columns: 1fr; gap: 2px; }
	.ahd-filters > input, .ahd-filters > select { max-width: none; flex-basis: 45%; }
	.ahd-b-body { padding-left: 0; }
	.ahd-b-summary { margin-left: 0; }
	.ahd-msg .ahd-avatar { display: none; }
	.ahd-event { padding-left: 0; }
}

/* ---------- E-mails page ---------- */
.ahd-pad { padding-left: 24px; padding-right: 24px; }
.ahd-table-card .ahd-card-head.ahd-pad { padding-top: 22px; margin-bottom: 14px; justify-content: space-between; }
.ahd-table-card > p.ahd-pad { padding-bottom: 18px; margin: 14px 0 0; }
.ahd-inline-form { display: flex; gap: 10px; max-width: 520px; }
.ahd-inline-form input { flex: 1; min-width: 0; }
.ahd-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 18px; }
.ahd-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ahd-muted); background: var(--ahd-bg); border: 1px solid var(--ahd-line); border-radius: 999px; padding: 3px 10px 3px 4px; }
.ahd .ahd-chip code { font-size: 12px; background: #fff; border: 1px solid var(--ahd-line); border-radius: 999px; padding: 1px 7px; color: var(--ahd-text); }
.ahd-mail-list { border: 1px solid var(--ahd-line); border-radius: 10px; overflow: hidden; }
.ahd-mail-item + .ahd-mail-item { border-top: 1px solid var(--ahd-line); }
.ahd-mail-item summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; cursor: pointer; list-style: none; font-weight: 600; font-size: 14px; }
.ahd-mail-item summary::-webkit-details-marker { display: none; }
.ahd-mail-item summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--ahd-muted); border-bottom: 2px solid var(--ahd-muted); transform: rotate(-45deg); margin-right: 4px; transition: transform .15s; flex: none; }
.ahd-mail-item[open] summary::before { transform: rotate(45deg); }
.ahd-mail-title { flex: 1; }
.ahd-mail-item summary:hover { background: #f8fafc; }
.ahd-mail-body { display: grid; gap: 14px; padding: 4px 18px 20px 38px; }
.ahd-mail-body .ahd-btn { justify-self: start; }
@media (max-width: 640px) {
	.ahd-inline-form { flex-direction: column; }
	.ahd-mail-body { padding-left: 18px; }
}

/* ---------- Reports ---------- */
.ahd-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ahd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ahd-small { font-size: 12px; }
.ahd-report-period { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 14px 16px; }
.ahd-seg { display: inline-flex; background: var(--ahd-bg); border: 1px solid var(--ahd-line); border-radius: 10px; padding: 3px; flex-wrap: wrap; }
.ahd .ahd-seg-btn { padding: 7px 14px; border-radius: 7px; font-size: 14px; font-weight: 500; color: var(--ahd-muted); text-decoration: none; }
.ahd .ahd-seg-btn:hover { color: var(--ahd-ink); }
.ahd .ahd-seg-btn.is-active { background: #fff; color: var(--ahd-ink); box-shadow: 0 1px 2px rgba(15, 23, 42, .08); font-weight: 600; }
.ahd-report-custom { display: flex; align-items: center; gap: 8px; }
.ahd .ahd-report-custom input[type=date] { width: 160px; height: 40px; }
.ahd .ahd-report-custom .ahd-btn { height: 40px; }
.ahd-kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin: 0 0 16px; }
.ahd-kpi { background: #fff; border: 1px solid var(--ahd-line); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.ahd-kpi-num { font-size: 26px; font-weight: 700; color: var(--ahd-ink); line-height: 1.2; letter-spacing: -.01em; }
.ahd-kpi-label { font-size: 13px; color: var(--ahd-muted); }
.ahd-kpi-note { font-size: 12px; color: #c2410c; margin-top: 2px; }
.ahd-report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; margin-bottom: 16px; }
.ahd-report-grid > .ahd-card { margin: 0; }
.ahd-report-wide { grid-column: 1 / -1; }
.ahd .ahd-table .ahd-r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ahd-pad-b { padding-bottom: 16px; }
.ahd-table-card .ahd-help.ahd-pad { margin: 10px 0 0; }
.ahd-bar-label { font-weight: 500; }
.ahd-bar { height: 4px; background: #f1f5f9; border-radius: 4px; margin-top: 6px; overflow: hidden; max-width: 260px; }
.ahd-bar span { display: block; height: 100%; background: var(--ahd-accent); border-radius: 4px; }
.ahd-subject { font-weight: 600; color: var(--ahd-ink); }
@media (max-width: 900px) {
	.ahd-kpis { grid-template-columns: repeat(2, 1fr); }
	.ahd-report-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
	.ahd-report-custom { flex-wrap: wrap; }
	.ahd .ahd-report-custom input[type=date] { width: 100%; }
}


/* ---------- Machine history ---------- */
.ahd .ahd-machine-link { color: inherit; text-decoration: underline; text-decoration-color: var(--ahd-line-strong); text-underline-offset: 3px; }
.ahd .ahd-machine-link:hover { color: var(--ahd-accent-dark); text-decoration-color: currentColor; }
.ahd-history { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 2px; }
.ahd .ahd-history a { display: grid; gap: 2px; padding: 9px 10px; margin: 0 -10px; border-radius: 8px; color: var(--ahd-text); }
.ahd .ahd-history a:hover { background: var(--ahd-bg); }
.ahd-history-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--ahd-ink); }
.ahd-history-sub { font-size: 13px; line-height: 1.35; }
.ahd-history-date { font-size: 12px; color: var(--ahd-faint); }
.ahd-inline-search { display: flex; gap: 10px; align-items: center; padding: 14px; }
.ahd-inline-search .ahd-search { flex: 1; }
.ahd-machine-head { display: flex; gap: 32px; align-items: flex-start; flex-wrap: wrap; }
.ahd-machine-serial { font-size: 26px; font-weight: 700; color: var(--ahd-ink); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.ahd-machine-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px 24px; margin: 0; flex: 1; }
.ahd-machine-stats dt { font-size: 12px; color: var(--ahd-muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.ahd-machine-stats dd { margin: 2px 0 0; color: var(--ahd-ink); font-weight: 600; }
.ahd-td-sol { max-width: 320px; font-size: 13px; }
.ahd-machine-warn { margin-top: 10px; padding: 12px 14px; border-radius: 10px; background: var(--ahd-bg); border: 1px solid var(--ahd-line); font-size: 14px; display: grid; gap: 4px; }
.ahd-machine-warn.is-open { background: #fff7ed; border-color: #fed7aa; }
.ahd-machine-warn strong { color: var(--ahd-ink); }
.ahd-machine-warn ul { margin: 4px 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.ahd-machine-warn li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- Solutions ---------- */
.ahd-suggest { margin-top: 12px; border: 1px solid var(--ahd-accent-line); background: var(--ahd-accent-soft); border-radius: 12px; padding: 14px; display: grid; gap: 8px; }
.ahd-suggest-head { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; color: var(--ahd-accent-dark); }
.ahd-suggest-head span { grid-column: 2; font-size: 13px; color: var(--ahd-muted); }
.ahd-suggest .ahd-sol-item { background: #fff; }
.ahd-sol-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.ahd .ahd-sol-item { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--ahd-line); border-radius: 10px; background: var(--ahd-card); color: var(--ahd-text); box-shadow: var(--ahd-shadow); transition: border-color .15s, transform .15s; }
.ahd .ahd-sol-item:hover { border-color: var(--ahd-accent-line); transform: translateY(-1px); }
.ahd-sol-meta { font-size: 12px; font-weight: 600; color: var(--ahd-accent-dark); text-transform: uppercase; letter-spacing: .04em; display: flex; gap: 6px; align-items: center; }
.ahd-sol-title { color: var(--ahd-ink); font-size: 15px; line-height: 1.35; }
.ahd-sol-line { font-size: 13px; line-height: 1.45; }
.ahd-sol-line b { color: var(--ahd-ink); font-weight: 600; }
.ahd-sol-detail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.ahd-prose { margin: 0; color: var(--ahd-ink); font-size: 15px; line-height: 1.65; }
.ahd-solution-card summary { list-style: none; cursor: pointer; margin: 0; }
.ahd-solution-card summary::-webkit-details-marker { display: none; }
.ahd-solution-card[open] summary { margin-bottom: 14px; }
.ahd-solution-card h2 { display: flex; align-items: center; gap: 8px; flex: 1; }
.ahd-solution-card h2 svg { width: 18px; height: 18px; color: var(--ahd-accent); }
.ahd-solution-card .ahd-field { margin-bottom: 12px; }
.ahd-solution-card .ahd-check { margin: 0 0 14px; font-size: 13px; align-items: flex-start; }
.ahd-solution-card p { margin: 2px 0 12px; color: var(--ahd-ink); }
.ahd-solution-card.is-prompt { border-color: var(--ahd-accent-line); background: var(--ahd-accent-soft); }

/* ---------- Manage panel ---------- */
.ahd-seg-sm { display: flex; width: 100%; }
.ahd .ahd-seg-sm label { flex: 1; margin: 0; cursor: pointer; }
.ahd .ahd-seg-sm input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ahd-seg-sm span { display: block; text-align: center; padding: 6px 4px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--ahd-muted); }
.ahd-seg-sm input:checked + span { background: #fff; color: var(--ahd-ink); font-weight: 600; box-shadow: 0 1px 2px rgba(15, 23, 42, .08); }
.ahd-seg-sm input:focus-visible + span { box-shadow: 0 0 0 3px var(--ahd-accent-line); }
.ahd-mfr-fields { padding: 12px; margin: 0 0 14px; border-radius: 10px; background: #ecfeff; border: 1px solid #a5f3fc; }
.ahd-mfr-fields .ahd-field:last-child { margin-bottom: 0; }

/* ---------- @mentions ---------- */
.ahd-mention-wrap { position: relative; }
.ahd-mention-menu { position: absolute; left: 12px; top: 100%; z-index: 20; margin: 4px 0 0; padding: 4px; list-style: none; min-width: 220px; background: #fff; border: 1px solid var(--ahd-line); border-radius: 10px; box-shadow: 0 8px 24px rgba(15, 23, 42, .12); }
.ahd-mention-menu li { padding: 7px 10px; border-radius: 7px; font-size: 14px; cursor: pointer; color: var(--ahd-ink); }
.ahd-mention-menu li.is-active, .ahd-mention-menu li:hover { background: var(--ahd-accent-soft); color: var(--ahd-accent-dark); }
.ahd-mention { color: var(--ahd-accent-dark); background: var(--ahd-accent-soft); border-radius: 4px; padding: 0 3px; font-weight: 600; }

/* ---------- Service bulletins (home page board + manager page) ---------- */
.ahd-board { display: grid; gap: 14px; }
.ahd-board-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ahd-board-head > div { display: flex; align-items: center; gap: 10px; }
.ahd .ahd-board-title { font-size: 22px; font-weight: 700; }
.ahd-board-unread { font-size: 12px; font-weight: 600; color: #fff; background: var(--ahd-accent); padding: 3px 9px; border-radius: 999px; }
.ahd-board-list { display: grid; gap: 12px; }
.ahd-bulletin { position: relative; background: var(--ahd-card); border: 1px solid var(--ahd-line); border-left: 4px solid var(--bl, var(--ahd-line-strong)); border-radius: 10px; padding: 16px 18px; box-shadow: var(--ahd-shadow); display: grid; gap: 6px; }
.ahd-bl-info { --bl: #2563eb; }
.ahd-bl-important { --bl: #ea580c; }
.ahd-bl-critical { --bl: #dc2626; }
.ahd-bulletin.is-unread { background: linear-gradient(0deg, var(--ahd-card), var(--ahd-card)); box-shadow: 0 0 0 1px var(--ahd-accent-line), var(--ahd-shadow); }
.ahd-bulletin-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--ahd-muted); }
.ahd-bl-level { font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--bl); }
.ahd-bl-tag { background: var(--ahd-bg); border: 1px solid var(--ahd-line); border-radius: 999px; padding: 1px 8px; font-weight: 500; color: var(--ahd-text); }
.ahd-bl-new { margin-left: auto; font-weight: 700; color: #fff; background: var(--ahd-accent); border-radius: 999px; padding: 1px 8px; }
.ahd .ahd-bulletin-title { font-size: 17px; font-weight: 700; line-height: 1.35; }
.ahd-bulletin-body { color: var(--ahd-text); font-size: 14px; line-height: 1.6; }
.ahd-bulletin-body p { margin: 0 0 8px; }
.ahd-bulletin-body p:last-child { margin: 0; }
.ahd-bl-more summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ahd-accent-dark); list-style: none; }
.ahd-bl-more summary::-webkit-details-marker { display: none; }
.ahd-bl-more[open] summary { display: none; }
.ahd-bl-more[open] + * { display: block; }
.ahd-bulletin:has(.ahd-bl-more[open]) > .ahd-bulletin-body:first-of-type { display: none; }
.ahd-bl-files { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.ahd-bl-files li { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 5px 10px; border: 1px solid var(--ahd-line); border-radius: 8px; background: var(--ahd-bg); }
.ahd-bl-files a { display: inline-flex; align-items: center; gap: 6px; }
.ahd-bl-files svg, .ahd-board-locked svg { width: 15px; height: 15px; }
.ahd-bl-files small { color: var(--ahd-faint); }
.ahd-bl-read { margin: 4px 0 0; }
.ahd-bl-read .ahd-btn { padding-left: 0; }
.ahd-board-locked { display: flex; align-items: center; gap: 14px; padding: 18px; border: 1px dashed var(--ahd-line-strong); border-radius: 12px; background: var(--ahd-bg); }
.ahd-board-locked > div { flex: 1; display: grid; }
.ahd-board-locked span { font-size: 14px; color: var(--ahd-muted); }
.ahd-board-locked svg { width: 22px; height: 22px; color: var(--ahd-muted); flex: none; }
.ahd-board-manage { gap: 16px; }
.ahd-bl-manage { display: grid; gap: 0; }
.ahd-bl-manage .ahd-bulletin { border-radius: 10px 10px 0 0; box-shadow: none; }
.ahd-bl-manage.is-expired .ahd-bulletin { opacity: .65; }
.ahd-bl-stats { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 18px; border: 1px solid var(--ahd-line); border-top: 0; border-radius: 0 0 10px 10px; background: var(--ahd-bg); font-size: 13px; }
.ahd-bl-stats details { flex-basis: 100%; order: 3; }
.ahd-bl-stats summary { cursor: pointer; color: var(--ahd-accent-dark); font-weight: 600; }
.ahd-bl-stats .ahd-row-btns { display: flex; gap: 6px; }
.ahd-bl-stats form { margin: 0; }
.ahd .ahd-danger { color: var(--ahd-danger); }

@media (max-width: 900px) {
	.ahd-stats { grid-template-columns: repeat(3, 1fr); }
	.ahd-sol-detail { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
	.ahd-stats { grid-template-columns: repeat(2, 1fr); }
	.ahd-sol-list { grid-template-columns: 1fr; }
	.ahd-inline-search { flex-direction: column; align-items: stretch; }
	.ahd-board-locked { flex-direction: column; align-items: flex-start; }
}
.ahd-solution-card summary::after { content: "Add"; font-size: 13px; font-weight: 600; color: var(--ahd-accent-dark); padding-right: 16px; background: no-repeat right center / 10px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2364748b' stroke-width='1.5'/%3E%3C/svg%3E"); }
.ahd-solution-card[open] summary::after { content: ""; transform: rotate(180deg); padding-right: 10px; }
.ahd-solution-card:has(.ahd-pill) summary::after { content: ""; }
@media (max-width: 1100px) and (min-width: 641px) { .ahd-kpis { grid-template-columns: repeat(3, 1fr); } }
.ahd-sol-detail .ahd-card-head.ahd-mt { margin-top: 24px; }

/* =========================================================================
   Home page [agri_home]
   ========================================================================= */
.ahd-home-page .entry-header, .ahd-home-page .page-header, .ahd-home-page h1.entry-title, .ahd-home-page .wp-block-post-title { display: none; }
.ahd-home { display: grid; gap: 28px; }
.ahd-home .ahd { max-width: none; }

.ahd-hero { position: relative; border-radius: 18px; overflow: hidden; color: #fff;
	background: radial-gradient(1200px 400px at 85% -10%, color-mix(in srgb, var(--ahd-accent) 55%, transparent), transparent 60%),
		linear-gradient(135deg, color-mix(in srgb, var(--ahd-accent) 45%, #0b1a10) 0%, #0f172a 100%); }
.ahd-hero.has-image { background: linear-gradient(100deg, rgba(10, 18, 12, .88) 0%, rgba(10, 18, 12, .7) 45%, rgba(10, 18, 12, .35) 100%), var(--hero-img) center / cover no-repeat; }
.ahd-hero::after { content: ""; position: absolute; inset: auto 0 0 0; height: 4px; background: var(--ahd-accent); }
.ahd-hero-inner { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 40px; align-items: center; padding: 56px 48px; }
.ahd-hero-kicker { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: color-mix(in srgb, var(--ahd-accent) 40%, #fff); margin-bottom: 14px; }
.ahd .ahd-hero-title { color: #fff; font-size: clamp(28px, 4vw, 42px); line-height: 1.12; font-weight: 700; letter-spacing: -.02em; max-width: 640px; }
.ahd-hero-intro { margin: 14px 0 0; font-size: 17px; line-height: 1.6; color: rgba(255, 255, 255, .82); max-width: 560px; }
.ahd-hero-points { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 10px; }
.ahd-hero-points li { display: flex; align-items: center; gap: 10px; font-size: 15px; color: rgba(255, 255, 255, .9); }
.ahd-hero-points svg { width: 18px; height: 18px; padding: 3px; border-radius: 50%; background: var(--ahd-accent); color: #fff; flex: none; }
.ahd-hero-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.ahd .ahd-btn-hero { background: #fff; color: var(--ahd-ink); border-color: #fff; height: 46px; padding: 0 20px; font-weight: 600; }
.ahd .ahd-btn-hero:hover { background: #f1f5f9; color: var(--ahd-ink); }
.ahd .ahd-btn-hero-ghost { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .45); height: 46px; padding: 0 20px; font-weight: 600; }
.ahd .ahd-btn-hero-ghost:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.ahd-hero-card { background: #fff; color: var(--ahd-text); border-radius: 14px; padding: 26px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.ahd .ahd-hero-card h2 { font-size: 19px; margin-bottom: 14px; }
.ahd-hero-login .ahd-notice { margin-bottom: 12px; }
.ahd-hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 18px; }
.ahd .ahd-hero-stats > a { display: grid; gap: 2px; padding: 14px 12px; border-radius: 10px; background: var(--ahd-bg); border: 1px solid var(--ahd-line); color: var(--ahd-muted); font-size: 12px; line-height: 1.3; transition: border-color .15s; }
.ahd .ahd-hero-stats > a:hover { border-color: var(--ahd-accent-line); }
.ahd-hero-stats strong { font-size: 26px; color: var(--ahd-ink); font-variant-numeric: tabular-nums; }
.ahd .ahd-hero-stats > a.is-alert { background: #f5f3ff; border-color: #ddd6fe; }
.ahd-hero-stats a.is-alert strong { color: #6d28d9; }
.ahd-hero-user { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding-top: 12px; margin-top: 4px; border-top: 1px solid var(--ahd-line); }
.ahd-hero-user > div { flex: 1; display: grid; font-size: 14px; line-height: 1.3; }
.ahd-hero-user strong { color: var(--ahd-ink); }
.ahd-hero-user span { font-size: 12px; color: var(--ahd-muted); }
.ahd .ahd-hero-logout { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ahd-text); padding: 7px 10px; border: 1px solid var(--ahd-line-strong); border-radius: 8px; }
.ahd-hero-logout svg { width: 15px; height: 15px; }

.ahd-home-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.ahd .ahd-home-card { position: relative; display: grid; gap: 6px; align-content: start; padding: 22px; background: var(--ahd-card); border: 1px solid var(--ahd-line); border-radius: 14px; box-shadow: var(--ahd-shadow); color: var(--ahd-muted); font-size: 14px; line-height: 1.5; transition: transform .15s, border-color .15s, box-shadow .15s; }
.ahd .ahd-home-card:hover { transform: translateY(-2px); border-color: var(--ahd-accent-line); box-shadow: 0 10px 24px rgba(15, 23, 42, .08); }
.ahd-home-card strong { font-size: 17px; color: var(--ahd-ink); }
.ahd-home-ico { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px; background: var(--ahd-accent-soft); color: var(--ahd-accent-dark); margin-bottom: 6px; }
.ahd-home-ico svg { width: 21px; height: 21px; }
.ahd-home-card em { position: absolute; top: 18px; right: 18px; display: inline-flex; align-items: center; gap: 4px; font-style: normal; font-size: 11px; font-weight: 600; color: var(--ahd-faint); }
.ahd-home-card em svg { width: 12px; height: 12px; }

.ahd-home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.ahd-home-side { display: grid; gap: 16px; }
.ahd .ahd-home-side h2 { font-size: 17px; margin-bottom: 12px; }
.ahd-home-contact dl { margin: 0 0 12px; display: grid; gap: 10px; }
.ahd-home-contact dt { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ahd-muted); }
.ahd-home-contact dd { margin: 2px 0 0; color: var(--ahd-ink); font-weight: 500; word-break: break-word; }
.ahd-home-steps ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.ahd-home-steps li { display: flex; gap: 12px; }
.ahd-home-steps li > span { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--ahd-ink); color: #fff; font-size: 13px; font-weight: 700; }
.ahd-home-steps strong { color: var(--ahd-ink); font-size: 14px; }
.ahd-home-steps p { margin: 2px 0 0; font-size: 13px; line-height: 1.45; color: var(--ahd-muted); }

@media (max-width: 960px) {
	.ahd-hero-inner { grid-template-columns: 1fr; padding: 40px 28px; gap: 28px; }
	.ahd-home-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
	.ahd-hero { border-radius: 14px; }
	.ahd-hero-inner { padding: 32px 20px; }
	.ahd-home-cards { grid-template-columns: 1fr; }
	.ahd-hero-stats { grid-template-columns: repeat(3, 1fr); padding: 14px; }
	.ahd-hero-stats strong { font-size: 22px; }
}
.ahd-hero-login form { margin-top: 0 !important; } .ahd .ahd-hero-login .ahd-login-foot { align-items: flex-start; }
/* Home page: break out of narrow theme content columns, keep our own type. */
.ahd.ahd-home { --hw: min(1240px, calc(100vw - 32px)); width: var(--hw) !important; max-width: none !important; position: relative; left: 50%; margin-left: calc(var(--hw) / -2) !important; margin-right: 0 !important; }
.ahd h1, .ahd h2, .ahd h3 { font-weight: 700; }
.ahd strong, .ahd b { font-weight: 600; font-family: inherit; }
.ahd .ahd-home-card strong { font-size: 17px; }
.ahd .ahd-hero-stats strong { font-size: 26px; font-weight: 700; }
.ahd .ahd-home-steps strong, .ahd .ahd-hero-user strong { font-size: 14px; }
@media (max-width: 640px) { .ahd .ahd-hero-stats strong { font-size: 22px; } }
.ahd .ahd-hero-intro { margin: 16px 0 0 !important; }

/* =========================================================================
   Bulletins page [agri_bulletins_page] + read report
   ========================================================================= */
.ahd.ahd-blpage { --hw: min(1240px, calc(100vw - 32px)); width: var(--hw) !important; max-width: none !important; position: relative; left: 50%; margin-left: calc(var(--hw) / -2) !important; margin-right: 0 !important; }
.ahd-board-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ahd .ahd-bulletin-title a { color: var(--ahd-ink); }
.ahd .ahd-bulletin-title a:hover { color: var(--ahd-accent-dark); }
.ahd-bl-num { font-weight: 700; color: var(--ahd-ink); font-variant-numeric: tabular-nums; }
.ahd-blpage-grid { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; align-items: start; }
.ahd-blf-wrap { position: sticky; top: 24px; }
.ahd-blf-toggle { display: none; }
.ahd-blf { display: grid; gap: 16px; padding: 18px; }
.ahd-blf fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.ahd-blf legend, .ahd-blf-field > span, .ahd-blf-dates span { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ahd-muted); margin: 0 0 6px; padding: 0; }
.ahd-blf-field { display: block; margin: 0; }
.ahd .ahd-blf select, .ahd .ahd-blf input[type=date] { height: 40px; font-size: 14px; }
.ahd-blf .ahd-search input { height: 40px; }
.ahd-blf-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.ahd .ahd-blf-pill { position: relative; margin: 0; cursor: pointer; }
.ahd .ahd-blf-pill input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ahd-blf-pill span { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--ahd-line-strong); border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--ahd-text); background: #fff; }
.ahd-blf-pill span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--bl); }
.ahd-blf-pill input:checked + span { border-color: var(--bl); background: color-mix(in srgb, var(--bl) 10%, #fff); color: var(--ahd-ink); font-weight: 600; }
.ahd-blf-pill input:focus-visible + span { box-shadow: 0 0 0 3px var(--ahd-accent-line); }
.ahd-blf-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: -6px; }
.ahd-blf-dates label { margin: 0; }
.ahd-blf .ahd-check { font-size: 14px; }
.ahd-blf-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.ahd-blpage-results { display: grid; gap: 12px; min-width: 0; }
.ahd-blpage-count { font-size: 13px; font-weight: 600; color: var(--ahd-muted); }
.ahd-bl-single { max-width: 860px; }
.ahd-bl-single .ahd-bulletin { padding: 26px 30px; }
.ahd-bl-single .ahd-bulletin-title { font-size: 24px; }
.ahd-bl-single .ahd-bulletin-body { font-size: 15px; }
.ahd-reads-summary { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.ahd-reads-num { display: grid; }
.ahd-reads-num strong { font-size: 26px; color: var(--ahd-ink); line-height: 1.1; }
.ahd-reads-num span { font-size: 13px; color: var(--ahd-muted); }
.ahd-reads-bar { flex: 1; min-width: 160px; height: 10px; border-radius: 999px; background: var(--ahd-bg); border: 1px solid var(--ahd-line); overflow: hidden; }
.ahd-reads-bar span { display: block; height: 100%; background: var(--ahd-accent); border-radius: 999px; }
.ahd-reads-pct { font-weight: 700; color: var(--ahd-ink); min-width: 42px; }
.ahd-reads-summary form { margin: 0; }
.ahd-reads-sent { flex-basis: 100%; margin: 0; }
.ahd-row-btns.ahd-mt { display: flex; gap: 8px; }
@media (max-width: 900px) {
	.ahd-blpage-grid { grid-template-columns: 1fr; }
	.ahd-blf-wrap { position: static; }
	.ahd-blf-toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; padding: 10px 14px; border: 1px solid var(--ahd-line); border-radius: 10px; background: #fff; font-weight: 600; color: var(--ahd-ink); margin-bottom: 10px; }
	.ahd-blf-toggle::-webkit-details-marker { display: none; }
}
.ahd-bl-confirm { display: flex; align-items: center; gap: 8px; margin: 4px 0 0; font-size: 13px; font-weight: 500; color: var(--ahd-accent-dark); } .ahd-bl-confirm svg { width: 16px; height: 16px; flex: none; }

/* ---------- Drafts ---------- */
.ahd-submit-bar .ahd-grow { flex: 1; }
.ahd-drafts { border-color: var(--ahd-accent-line); }
.ahd-drafts .ahd-card-head { flex-wrap: wrap; }
.ahd-drafts .ahd-card-head .ahd-sub { margin: 0; font-size: 13px; text-align: right; }
.ahd-drafts ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ahd-drafts li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--ahd-line); border-radius: 10px; background: var(--ahd-bg); flex-wrap: wrap; }
.ahd-draft-info { display: grid; min-width: 0; }
.ahd-draft-info strong { color: var(--ahd-ink); }
.ahd-draft-info span { font-size: 13px; color: var(--ahd-muted); }
.ahd-drafts .ahd-row-btns { display: flex; gap: 6px; align-items: center; }
.ahd-drafts form { margin: 0; }
.ahd-draft-files { list-style: none; margin: 6px 0 10px; padding: 0; display: grid; gap: 6px; }
.ahd-draft-files li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border: 1px solid var(--ahd-accent-line); background: var(--ahd-accent-soft); border-radius: 8px; font-size: 14px; }
.ahd-draft-file { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.ahd-draft-file svg { width: 15px; height: 15px; flex: none; }
.ahd-draft-file small { color: var(--ahd-muted); }
.ahd .ahd-draft-remove { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ahd-muted); margin: 0; cursor: pointer; white-space: nowrap; }
.ahd-draft-files li:has(input:checked) { opacity: .5; text-decoration: line-through; }
@media (max-width: 640px) {
	.ahd-submit-bar { flex-wrap: wrap; }
	.ahd-submit-bar .ahd-btn-lg { flex: 1 1 100%; }
	.ahd-submit-bar .ahd-grow { display: none; }
	.ahd-drafts .ahd-card-head .ahd-sub { text-align: left; flex-basis: 100%; }
}
.ahd-blf { grid-template-columns: minmax(0, 1fr); }
.ahd-blf > *, .ahd-blf .ahd-search, .ahd-blf select, .ahd-blf input { min-width: 0; max-width: 100%; }
.ahd-blf .ahd-search { width: 100%; }
.ahd-blf-dates { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .ahd .ahd-blf-dates input { padding: 0 8px; font-size: 13px; }

/* =========================================================================
   Field visits
   ========================================================================= */
.ahd-vs-requested { background: #fef3c7; color: #92400e; }
.ahd-vs-booked { background: #eff6ff; color: #1d4ed8; }
.ahd-vs-confirmed { background: #ecfeff; color: #0e7490; }
.ahd-vs-completed { background: #f0fdf4; color: #15803d; }
.ahd-vs-declined, .ahd-vs-cancelled { background: #f1f5f9; color: #475569; }
.ahd-ch-to_invoice { background: #fff7ed; color: #c2410c; }
.ahd-ch-invoiced { background: #f0fdf4; color: #15803d; }
.ahd-ch-waived { background: #f1f5f9; color: #475569; }
.ahd-oc-justified.ahd-oc-pill { background: #f0fdf4; color: #15803d; }
.ahd-oc-avoidable.ahd-oc-pill { background: #fff7ed; color: #c2410c; }
.ahd-oc-not_prepared.ahd-oc-pill { background: #fef2f2; color: #b91c1c; }
.ahd-oc-no_fault.ahd-oc-pill { background: #f1f5f9; color: #475569; }

.ahd-visit-card h2 { display: flex; align-items: center; gap: 8px; flex: 1; }
.ahd-visit-card h2 svg, .ahd-upcoming h2 svg { width: 18px; height: 18px; color: var(--ahd-accent); }
.ahd-visit-card .ahd-card-head { flex-wrap: wrap; }
.ahd-kv-tight > div { padding: 6px 0; }
.ahd-kv-tight dd { text-align: right; }
.ahd-visit-links { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 12px; font-size: 13px; font-weight: 600; }
.ahd-visit-links a { display: inline-flex; align-items: center; gap: 5px; }
.ahd-visit-links svg { width: 14px; height: 14px; }
.ahd-visit-more { margin-top: 10px; }
.ahd-visit-more > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ahd-accent-dark); list-style: none; padding: 4px 0; }
.ahd-visit-more > summary::-webkit-details-marker { display: none; }
.ahd-visit-request > summary.ahd-btn { color: var(--ahd-ink); justify-content: center; }
.ahd-visit-request[open] > summary { margin-bottom: 12px; }
.ahd-visit-form { display: grid; gap: 12px; }
.ahd-visit-form .ahd-field { margin: 0; }
.ahd-visit-form .ahd-check { font-size: 13px; align-items: flex-start; line-height: 1.4; }
.ahd-visit-form .ahd-check input { margin-top: 2px; flex: none; }
.ahd-visit-form textarea, .ahd-visit-more textarea { min-height: 0; margin-bottom: 8px; }
.ahd-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ahd-row2 .ahd-field { margin: 0; }
.ahd-geo { margin-top: 6px; padding-left: 0; }
.ahd-geo svg { width: 15px; height: 15px; }
.ahd-visit-terms { padding: 12px 14px; border-radius: 10px; background: var(--ahd-bg); border: 1px solid var(--ahd-line); font-size: 13px; }
.ahd-visit-terms p { margin: 6px 0 0; }
.ahd-visit-confirm { display: grid; gap: 10px; margin-top: 10px; }
.ahd-visit-confirm .ahd-check { font-size: 13px; align-items: flex-start; }
.ahd-visit-card > .ahd-btn-block { margin-top: 6px; }
.ahd-visit-history { list-style: none; margin: 12px 0 0; padding: 12px 0 0; border-top: 1px solid var(--ahd-line); display: grid; gap: 6px; }
.ahd .ahd-visit-history a { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ahd-text); }
.ahd-visit-history strong { margin-left: auto; color: var(--ahd-ink); }

.ahd-visit-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.ahd-visit-main { display: grid; gap: 16px; min-width: 0; }
.ahd-visit-main > .ahd-card { margin: 0; }
.ahd-onsite-steps { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ahd-onsite-step { display: grid; gap: 4px; padding: 16px; border: 1px dashed var(--ahd-line-strong); border-radius: 12px; margin: 0; }
.ahd-onsite-step strong { color: var(--ahd-ink); font-size: 15px; }
.ahd-onsite-step span { font-size: 13px; color: var(--ahd-muted); }
.ahd-onsite-step .ahd-btn { justify-self: start; margin-top: 6px; }
.ahd-onsite-step.is-done { border-style: solid; border-color: #bbf7d0; background: #f0fdf4; }
.ahd-onsite-step.is-done strong::before { content: "✓ "; color: #15803d; }
.ahd-outcomes { border: 0; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ahd-outcomes legend { margin-bottom: 8px; }
.ahd .ahd-outcome { position: relative; margin: 0; cursor: pointer; }
.ahd .ahd-outcome input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ahd-outcome span { display: grid; gap: 2px; padding: 12px 14px; border: 1.5px solid var(--ahd-line); border-left: 4px solid var(--oc); border-radius: 10px; background: #fff; height: 100%; }
.ahd-outcome strong { color: var(--ahd-ink); font-size: 14px; }
.ahd-outcome small { font-size: 12px; color: var(--ahd-muted); line-height: 1.4; }
.ahd-outcome input:checked + span { border-color: var(--oc); background: color-mix(in srgb, var(--oc) 8%, #fff); box-shadow: 0 0 0 1px var(--oc); }
.ahd-outcome input:focus-visible + span { box-shadow: 0 0 0 3px var(--ahd-accent-line); }
.ahd-oc-justified { --oc: #16a34a; }
.ahd-oc-avoidable { --oc: #ea580c; }
.ahd-oc-not_prepared { --oc: #dc2626; }
.ahd-oc-no_fault { --oc: #64748b; }
.ahd-notdone.is-key textarea { border-color: #fdba74; background: #fffbf5; }
.ahd-charge { margin: 6px 0 18px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--ahd-line); background: var(--ahd-bg); }
.ahd-charge-toggle { font-size: 15px; }
.ahd-charge .ahd-help { margin: 4px 0 0; }
.ahd-charge-lines { margin-top: 12px; }
.ahd .ahd-charge-table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 0; border: 0; }
.ahd .ahd-charge-table th { text-align: left; font-size: 12px; color: var(--ahd-muted); font-weight: 600; padding: 6px 6px; border: 0; border-bottom: 1px solid var(--ahd-line); }
.ahd .ahd-charge-table td { padding: 6px; border: 0; border-bottom: 1px solid #eef2f6; vertical-align: middle; }
.ahd .ahd-charge-table input { height: 36px; font-size: 14px; max-width: 130px; }
.ahd .ahd-charge-table tfoot td { border-bottom: 0; padding-top: 10px; font-weight: 600; color: var(--ahd-ink); }
.ahd .ahd-charge-table .ahd-r, .ahd .ahd-table .ahd-r { text-align: right; }
.ahd-charge-view { margin-top: 4px !important; }
.ahd-sig { position: relative; border: 1px dashed var(--ahd-line-strong); border-radius: 10px; background: #fff; overflow: hidden; margin-bottom: 8px; }
.ahd-sig canvas { display: block; width: 100%; height: auto; aspect-ratio: 3 / 1; touch-action: none; cursor: crosshair; }
.ahd-sig-clear { position: absolute; top: 6px; right: 6px; }
.ahd-sig-img { max-width: 280px; border: 1px solid var(--ahd-line); border-radius: 8px; display: block; }
.ahd-charge-manage { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.ahd .ahd-charge-manage select, .ahd .ahd-charge-manage input { height: 36px; font-size: 13px; width: auto; max-width: 150px; }

.ahd-visit-filter { margin: 10px 0 0; max-width: 260px; }
.ahd-cal { padding: 16px; }
.ahd-cal-head { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 12px; }
.ahd .ahd-cal-head h2 { font-size: 18px; min-width: 180px; text-align: center; }
.ahd-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--ahd-line); border-left: 1px solid var(--ahd-line); }
.ahd-cal-dow { font-size: 12px; font-weight: 600; text-transform: uppercase; color: var(--ahd-muted); padding: 8px; border-right: 1px solid var(--ahd-line); border-bottom: 1px solid var(--ahd-line); background: var(--ahd-bg); }
.ahd-cal-day { min-height: 104px; padding: 6px; border-right: 1px solid var(--ahd-line); border-bottom: 1px solid var(--ahd-line); display: grid; align-content: start; gap: 4px; min-width: 0; }
.ahd-cal-day.is-out { background: #fafbfc; }
.ahd-cal-day.is-out .ahd-cal-num { color: var(--ahd-faint); }
.ahd-cal-num { font-size: 12px; font-weight: 600; color: var(--ahd-text); }
.ahd-cal-day.is-today .ahd-cal-num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ahd-accent); color: #fff; }
.ahd .ahd-cal-ev { display: block; font-size: 11.5px; line-height: 1.3; padding: 4px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; padding-right: 22px; }
.ahd-cal-ev i { position: absolute; right: 4px; top: 3px; font-style: normal; font-size: 10px; font-weight: 700; opacity: .7; }
.ahd-cal-legend { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.ahd-charges-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ahd-charges-total { display: flex; align-items: baseline; gap: 10px; margin-left: auto; }
.ahd-charges-total span { font-size: 13px; color: var(--ahd-muted); }
.ahd-charges-total strong { font-size: 22px; color: var(--ahd-ink); }

.ahd-upcoming ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ahd .ahd-upcoming a { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--ahd-line); color: var(--ahd-text); }
.ahd .ahd-upcoming a:hover { border-color: var(--ahd-accent-line); }
.ahd-upcoming .ahd-card-head { justify-content: space-between; }
.ahd-upcoming h2 { display: flex; align-items: center; gap: 8px; }
.ahd-upc-date { flex: none; width: 48px; display: grid; justify-items: center; font-size: 11px; text-transform: uppercase; color: var(--ahd-muted); line-height: 1.1; }
.ahd-upc-date b { font-size: 20px; color: var(--ahd-ink); }
.ahd-upc-info { flex: 1; display: grid; min-width: 0; }
.ahd-upc-info strong { color: var(--ahd-ink); }
.ahd-upc-info span { font-size: 12px; color: var(--ahd-muted); }

@media (max-width: 960px) {
	.ahd-visit-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
	.ahd-onsite-steps, .ahd-outcomes, .ahd-row2 { grid-template-columns: 1fr; }
	.ahd-cal-day { min-height: 64px; padding: 3px; }
	.ahd .ahd-cal-ev { font-size: 0; padding: 0; height: 8px; border-radius: 4px; }
	.ahd .ahd-cal-ev b, .ahd-cal-ev i { display: none; }
	.ahd .ahd-charge-table input { max-width: 90px; }
	.ahd-upcoming .ahd-pill { display: none; }
}
.ahd .ahd-charge-table td.ahd-r, .ahd .ahd-charge-table td[data-amount] { white-space: nowrap; }
@media (max-width: 640px) {
	.ahd .ahd-charge-table { font-size: 13px; }
	.ahd .ahd-charge-table td { padding: 5px 3px; }
	.ahd .ahd-charge-table input { max-width: 76px; padding: 0 6px; height: 34px; font-size: 13px; }
	.ahd .ahd-charge-table input[name=extra_label] { max-width: 96px; }
	.ahd .ahd-charge-table th:nth-child(2) { width: 52px; }
	.ahd .ahd-charge-table td:first-child { font-size: 12px; line-height: 1.3; }
}
.ahd .ahd-charge-table input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.ahd .ahd-charge-table input[type=number]::-webkit-inner-spin-button, .ahd .ahd-charge-table input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.ahd-roles .ahd-yes { color: #15803d; font-weight: 700; } .ahd-roles .ahd-no { color: var(--ahd-faint); }

/* ---------- User access ---------- */
.ahd-acc-tags { max-width: 420px; }
.ahd-acc-tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; margin: 2px 2px 2px 0; }
.ahd-acc-tag.is-allow { background: #f0fdf4; color: #15803d; }
.ahd-acc-tag.is-deny { background: #fef2f2; color: #b91c1c; }
.ahd-access-form { display: grid; gap: 16px; }
.ahd-acc-group { margin: 0; }
.ahd-acc-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 0; border-top: 1px solid #eef2f6; }
.ahd-acc-row:first-of-type { border-top: 0; padding-top: 0; }
.ahd-acc-row.is-custom .ahd-acc-info strong::after { content: "custom"; margin-left: 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ahd-accent-dark); background: var(--ahd-accent-soft); padding: 1px 6px; border-radius: 999px; vertical-align: 2px; }
.ahd-acc-info { display: grid; gap: 2px; min-width: 0; }
.ahd-acc-info strong { color: var(--ahd-ink); font-size: 15px; }
.ahd-acc-info span { font-size: 13px; color: var(--ahd-muted); }
.ahd-acc-info small { font-size: 12px; color: var(--ahd-muted); }
.ahd-acc-info .ahd-yes { color: #15803d; } .ahd-acc-info .ahd-no { color: #b91c1c; }
.ahd .ahd-acc-seg { width: auto; flex: none; min-width: 300px; }
.ahd-acc-seg .ahd-acc-allow input:checked + span { background: #16a34a; color: #fff; }
.ahd-acc-seg .ahd-acc-deny input:checked + span { background: #dc2626; color: #fff; }
.ahd-acc-seg input:disabled + span { opacity: .5; cursor: not-allowed; }
.ahd-acc-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.ahd-acc-log time { color: var(--ahd-muted); margin-right: 6px; }
@media (max-width: 760px) {
	.ahd-acc-row { flex-direction: column; align-items: stretch; gap: 10px; }
	.ahd .ahd-acc-seg { min-width: 0; width: 100%; }
}

/* ---------- Organisations & access profiles ---------- */
.ahd-access-tabs { margin: 0 0 4px; }
.ahd-new-profile { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 18px; }
.ahd-new-profile strong { color: var(--ahd-ink); margin-right: 4px; }
.ahd .ahd-new-profile input[type=text] { flex: 1 1 200px; width: auto; }
.ahd .ahd-new-profile select { flex: 0 1 200px; width: auto; }
.ahd-org-dealership { background: #eff6ff; color: #1d4ed8; }
.ahd-org-importer { background: var(--ahd-accent-soft); color: var(--ahd-accent-dark); }
.ahd-row-actions { white-space: nowrap; }
.ahd-row-actions form, .ahd-row-actions a { display: inline-block; margin: 0 0 0 4px; }
.ahd-inline-row { margin: 0; }
.ahd .ahd-inline-row select { height: 36px; font-size: 14px; max-width: 240px; }
.ahd-org-edit .ahd-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.ahd-grid-card { overflow: hidden; }
.ahd .ahd-perm-grid { width: 100%; border-collapse: separate; border-spacing: 0; margin: 0; border: 0; font-size: 14px; }
.ahd .ahd-perm-grid th, .ahd .ahd-perm-grid td { border: 0; border-bottom: 1px solid #eef2f6; padding: 10px 12px; vertical-align: middle; background: #fff; }
.ahd .ahd-perm-grid thead th { position: sticky; top: 0; z-index: 2; background: var(--ahd-bg); border-bottom: 1px solid var(--ahd-line); vertical-align: bottom; }
.ahd .ahd-perm-grid .ahd-pg-perm { position: sticky; left: 0; z-index: 1; text-align: left; min-width: 280px; max-width: 360px; font-weight: 400; box-shadow: 1px 0 0 var(--ahd-line); }
.ahd .ahd-perm-grid thead .ahd-pg-perm { z-index: 3; }
.ahd-pg-perm strong { display: block; color: var(--ahd-ink); font-weight: 600; }
.ahd-pg-perm span { display: block; font-size: 12px; color: var(--ahd-muted); line-height: 1.4; }
.ahd .ahd-perm-grid .ahd-pg-col { min-width: 150px; text-align: center; }
.ahd .ahd-perm-grid .ahd-pg-name { height: 34px; font-size: 14px; font-weight: 600; text-align: center; margin-bottom: 6px; }
.ahd .ahd-perm-grid .ahd-pg-type { height: 30px; font-size: 12px; margin-bottom: 4px; }
.ahd-pg-count { display: block; font-size: 11px; color: var(--ahd-muted); font-weight: 500; text-transform: none; }
.ahd .ahd-perm-grid tr.ahd-pg-group th { background: var(--ahd-bg); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ahd-accent-dark); padding: 8px 12px; text-align: left; }
.ahd .ahd-perm-grid tr.ahd-pg-sub th, .ahd .ahd-perm-grid tr.ahd-pg-sub td { padding-top: 5px; padding-bottom: 5px; background: #fcfdfe; }
.ahd-pg-sub .ahd-pg-perm span { padding-left: 14px; }
.ahd .ahd-perm-grid td { text-align: center; }
.ahd .ahd-perm-grid tbody tr:hover td, .ahd .ahd-perm-grid tbody tr:hover th { background: #f8fafc; }
.ahd .ahd-pg-box { display: inline-grid; place-items: center; margin: 0; cursor: pointer; position: relative; }
.ahd .ahd-pg-box input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ahd-pg-box span { width: 26px; height: 26px; border-radius: 8px; border: 1.5px solid var(--ahd-line-strong); background: #fff; display: grid; place-items: center; transition: all .12s; }
.ahd-pg-box input:checked + span { background: var(--ahd-accent); border-color: var(--ahd-accent); }
.ahd-pg-box input:checked + span::after { content: ""; width: 7px; height: 12px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); }
.ahd-pg-box input:focus-visible + span { box-shadow: 0 0 0 3px var(--ahd-accent-line); }
.ahd-pg-small span { width: 20px; height: 20px; border-radius: 6px; }
.ahd-pg-small input:checked + span::after { width: 5px; height: 9px; }
.ahd-pg-danger input:checked + span { background: var(--ahd-danger); border-color: var(--ahd-danger); }
.ahd-pg-danger input:checked + span::after { border: 0; width: 12px; height: 2.5px; background: #fff; transform: none; }
@media (max-width: 760px) {
	.ahd-org-edit .ahd-grid { grid-template-columns: 1fr; }
	.ahd .ahd-perm-grid .ahd-pg-perm { min-width: 190px; }
	.ahd-pg-perm span { display: none; }
	.ahd-pg-sub .ahd-pg-perm span { display: block; }
}

/* ---------- Mobile app: offline bar, outbox, alerts ---------- */
.ahd-netbar { margin: 0 0 16px; padding: 12px 16px; border: 1px solid #e7dcb6; background: #fffaf0; border-radius: 12px; font-size: 14px; }
.ahd-netbar.is-offline { border-color: #d9dcd2; background: #f2f3ef; }
.ahd-netbar-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.ahd-netbar-head strong { color: var(--ahd-ink); }
.ahd-netbar-head strong::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #c98a00; margin-right: 8px; vertical-align: 1px; }
.ahd-netbar.is-offline .ahd-netbar-head strong::before { background: #8a8f80; }
.ahd-netbar-head span { color: var(--ahd-muted); flex: 1 1 240px; }
.ahd-outbox { list-style: none; margin: 10px 0 0; padding: 0; border-top: 1px solid rgba(0,0,0,.07); }
.ahd-outbox li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid rgba(0,0,0,.05); }
.ahd-outbox li:last-child { border-bottom: 0; }
.ahd-ob-label { font-weight: 600; color: var(--ahd-ink); flex: 1 1 200px; }
.ahd-ob-meta { color: var(--ahd-muted); font-size: 13px; }
.ahd-ob-err { color: #b42318; font-size: 13px; flex-basis: 100%; }
.ahd-btn-sm { padding: 6px 12px; font-size: 13px; min-height: 0; }
.ahd-link-btn { background: none; border: 0; padding: 0; color: var(--ahd-muted); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; }
.ahd-link-btn:hover { color: #b42318; }
.ahd-toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; z-index: 99999; max-width: min(92vw, 460px); background: #1c2410; color: #fff; padding: 12px 18px; border-radius: 12px; font: 500 14px/1.4 Inter, system-ui, sans-serif; box-shadow: 0 10px 30px rgba(0,0,0,.2); transition: opacity .3s, transform .3s; }
.ahd-toast.is-warn { background: #5b4300; }
.ahd-toast.is-in { opacity: 1; transform: translate(-50%, 0); }
.ahd-app-nudge { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 16px; padding: 12px 16px; border-radius: 12px; background: var(--ahd-accent-soft, #eef2e3); font-size: 14px; color: var(--ahd-ink); }
.ahd-app-nudge[hidden] { display: none; }
.ahd-app-nudge span { flex: 1 1 220px; }
.ahd-queued-note { margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; background: #fffaf0; border: 1px solid #e7dcb6; color: #5b4300; font-size: 14px; }
.ahd-onsite-step.is-queued { border-style: dashed; }
.ahd-onsite-step button[hidden] { display: none; }
.ahd-account .ahd-device { grid-column: 1 / -1; order: 3; }
.ahd-device-rows { display: grid; gap: 4px; }
.ahd-device-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--ahd-line, #e8eae3); }
.ahd-device-row:last-child { border-bottom: 0; }
.ahd-device-row strong { display: block; color: var(--ahd-ink); }
.ahd-dev-status { display: block; color: var(--ahd-muted); font-size: 14px; }
.ahd-dev-ico { width: 40px; height: 40px; border-radius: 10px; background: #f2f3ef; display: inline-flex; align-items: center; justify-content: center; color: var(--ahd-muted); }
.ahd-dev-ico svg { width: 20px; height: 20px; }
.ahd-device-row.is-ok .ahd-dev-ico { background: var(--ahd-accent-soft, #eef2e3); color: var(--ahd-accent); }
.ahd-dev-act { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; font-size: 13px; color: var(--ahd-muted); }
.ahd-dev-list { margin-top: 10px; font-size: 14px; }
.ahd-dev-list summary { cursor: pointer; color: var(--ahd-muted); }
.ahd-dev-list ul { list-style: none; margin: 8px 0 0; padding: 0; }
.ahd-dev-list li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.ahd-app-icon-row { display: flex; gap: 12px; align-items: center; }
.ahd-app-icon-row img { border-radius: 12px; flex: none; }
.ahd-app-icon-row input { flex: 1; }
@media (max-width: 600px) {
	.ahd-device-row { grid-template-columns: 40px minmax(0, 1fr); }
	.ahd-dev-act { grid-column: 2; justify-content: flex-start; }
}
/* Opened as an installed app: no theme chrome, room for the notch. */
html.ahd-standalone body.ahd-portal-page { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }

/* ---------- Notification bell ---------- */
.ahd-bell-wrap { position: relative; }
.ahd .ahd-bell { position: relative; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--ahd-line-strong); background: #fff; color: var(--ahd-ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; transition: background .15s, border-color .15s; }
.ahd .ahd-bell:hover, .ahd-bell-wrap.is-open .ahd-bell { background: var(--ahd-accent-soft); border-color: var(--ahd-accent); }
.ahd .ahd-bell svg { width: 20px; height: 20px; }
.ahd-bell.has-new svg { animation: ahd-ring 1.2s ease 1; transform-origin: 50% 10%; }
@keyframes ahd-ring { 0%,100% { transform: rotate(0); } 15% { transform: rotate(14deg); } 30% { transform: rotate(-12deg); } 45% { transform: rotate(8deg); } 60% { transform: rotate(-5deg); } }
.ahd-bell-n { position: absolute; top: -6px; right: -6px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: #d92d20; color: #fff; font: 700 11px/19px Inter, system-ui, sans-serif; text-align: center; box-shadow: 0 0 0 2px #fff; }
.ahd-bell-n[hidden] { display: none; }
.ahd-bell-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 380px; max-width: calc(100vw - 24px); background: #fff; border: 1px solid var(--ahd-line); border-radius: 14px; box-shadow: 0 18px 50px rgba(15, 23, 42, .18); z-index: 1000; overflow: hidden; text-align: left; }
.ahd-bell-panel[hidden] { display: none; }
.ahd-bell-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--ahd-line); }
.ahd-bell-head strong { color: var(--ahd-ink); font-size: 15px; }
.ahd-bell-head .ahd-link-btn:hover { color: var(--ahd-accent); }
.ahd-bell-list { list-style: none; margin: 0; padding: 0; max-height: min(460px, 65vh); overflow-y: auto; overscroll-behavior: contain; }
.ahd-bell-list li { margin: 0; border-bottom: 1px solid var(--ahd-line); }
.ahd-bell-list li:last-child { border-bottom: 0; }
.ahd-bell-empty { padding: 28px 18px; color: var(--ahd-muted); font-size: 14px; text-align: center; }
.ahd .ahd-bell-item { display: grid; grid-template-columns: 30px minmax(0, 1fr); column-gap: 10px; padding: 12px 16px; text-decoration: none; color: var(--ahd-ink); position: relative; }
.ahd .ahd-bell-item:hover { background: #f8faf5; }
.ahd-bell-item::before { content: ""; grid-row: 1 / span 3; width: 30px; height: 30px; border-radius: 50%; background: #f1f5f9 no-repeat center / 16px; }
.ahd-bell-item > * { grid-column: 2; }
.ahd-bell-item strong { font-size: 14px; font-weight: 600; line-height: 1.35; }
.ahd-bell-item.is-new { background: color-mix(in srgb, var(--ahd-accent) 6%, #fff); }
.ahd .ahd-bell-item.is-new { padding-right: 30px; }
.ahd-bell-item.is-new::after { content: ""; position: absolute; right: 14px; top: 18px; width: 8px; height: 8px; border-radius: 50%; background: var(--ahd-accent); }
.ahd-bell-body { font-size: 13px; color: var(--ahd-muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.ahd-bell-when { font-size: 12px; color: var(--ahd-faint, #94a3b8); margin-top: 3px; }
.ahd-bi-reply::before { background-color: #eef2e3; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f7f00' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M21 12a8 8 0 0 1-11.6 7.1L4 20l1-4.6A8 8 0 1 1 21 12z'/%3E%3C/svg%3E"); }
.ahd-bi-assigned::before { background-color: #e8f0fe; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231d4ed8' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21a8 8 0 0 1 16 0'/%3E%3C/svg%3E"); }
.ahd-bi-visit::before { background-color: #fef3e2; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b45309' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M12 21s-7-6.2-7-11a7 7 0 0 1 14 0c0 4.8-7 11-7 11z'/%3E%3Ccircle cx='12' cy='10' r='2.5'/%3E%3C/svg%3E"); }
.ahd-bi-bulletin::before { background-color: #fdecec; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b42318' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M3 11v2a1 1 0 0 0 1 1h2l5 4V6L6 10H4a1 1 0 0 0-1 1zM15.5 8.5a5 5 0 0 1 0 7M18.5 5.5a9 9 0 0 1 0 13'/%3E%3C/svg%3E"); }
.ahd-bi-mention::before { background-color: #f3e8ff; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237e22ce' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8'/%3E%3C/svg%3E"); }
.ahd-bi-done::before { background-color: #e7f6ec; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23157f3c' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
@media (max-width: 600px) {
	.ahd-bell-wrap { position: static; }
	.ahd-bell-panel { position: fixed; left: 12px; right: 12px; top: 72px; width: auto; max-width: none; }
}

/* WhatsApp settings */
.ahd-wa-help { margin: 12px 0; padding: 12px 16px; border: 1px solid var(--ahd-line); border-radius: 12px; background: #fafbf8; font-size: 14px; }
.ahd-wa-help summary { cursor: pointer; font-weight: 600; color: var(--ahd-ink); }
.ahd-wa-help ol { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 8px; }
.ahd-wa-tpl { background: #fff; border: 1px solid var(--ahd-line); border-radius: 8px; padding: 10px 12px; margin: 8px 0; font: 13px/1.5 ui-monospace, Menlo, monospace; white-space: pre-wrap; }
.ahd-pill-ok { background: #e7f6ec; color: #157f3c; }
.ahd-pill-err { background: #fdecec; color: #b42318; }
.ahd-err-text { color: #b42318; }
.ahd-table-compact td, .ahd-table-compact th { padding: 8px 10px; font-size: 13px; }

.ahd-wa-test { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ahd-wa-test input { flex: 1 1 220px; max-width: 320px; }

/* ---------- Visit location picker ---------- */
.ahd-loc-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.ahd-loc-tools .ahd-btn svg { width: 15px; height: 15px; }
.ahd-loc-map { margin-bottom: 8px; }
.ahd-loc-map[hidden] { display: none; }
.ahd-loc-canvas { height: 320px; border-radius: 12px; border: 1px solid var(--ahd-line-strong); overflow: hidden; background: #e8ecef; z-index: 0; }
.ahd-loc-maphelp { font-size: 13px; color: var(--ahd-muted); margin-top: 6px; }
.ahd-loc-input { font-variant-numeric: tabular-nums; }
.ahd-loc-preview { margin: 12px 0 6px; }
.ahd-loc-preview[hidden] { display: none; }
.ahd-loc-preview .ahd-loc-canvas { height: 180px; }
.ahd-loc-links { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin: 0 0 8px; font-size: 14px; }
.ahd-loc-links a { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.ahd-loc-links svg { width: 15px; height: 15px; }
.ahd-pin span { position: absolute; left: 3px; top: 0; width: 24px; height: 24px; border-radius: 50% 50% 50% 0; background: #d92d20; transform: rotate(-45deg); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.ahd-pin span::after { content: ""; position: absolute; left: 7px; top: 7px; width: 6px; height: 6px; border-radius: 50%; background: #fff; }
.ahd .leaflet-control-layers label { margin: 0; font-size: 13px; }
.ahd .leaflet-container a { color: #0078a8; }

/* ---------- Machine register ---------- */
.ahd-reg-field { position: relative; }
.ahd-msuggest { position: absolute; left: 0; right: 0; z-index: 50; margin: 4px 0 0; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--ahd-line-strong); border-radius: 12px; box-shadow: 0 14px 40px rgba(15,23,42,.16); max-height: 320px; overflow-y: auto; }
.ahd-msuggest[hidden] { display: none; }
.ahd-msuggest li { display: grid; gap: 1px; padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.ahd-msuggest li:hover, .ahd-msuggest li.is-active { background: var(--ahd-accent-soft); }
.ahd-msuggest b { color: var(--ahd-ink); font-variant-numeric: tabular-nums; }
.ahd-msuggest span { color: var(--ahd-ink); }
.ahd-msuggest small { color: var(--ahd-muted); font-size: 12px; }
.ahd-reg-note { margin-top: 8px; padding: 9px 12px; border-radius: 10px; background: var(--ahd-accent-soft); color: var(--ahd-ink); font-size: 13px; }
.ahd-reg-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.ahd-reg-stats .ahd-card { margin: 0; display: grid; gap: 2px; }
.ahd-reg-stats strong { font-size: 22px; color: var(--ahd-ink); }
.ahd-reg-stats span { color: var(--ahd-muted); font-size: 13px; }
.ahd-reg-ways { display: grid; gap: 14px; }
.ahd-reg-way { border: 1px solid var(--ahd-line); border-radius: 12px; padding: 16px; }
.ahd-reg-way h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 16px; color: var(--ahd-ink); }
.ahd-copy { display: flex; gap: 8px; align-items: center; }
.ahd-copy input { flex: 1; font: 13px ui-monospace, Menlo, monospace; }
.ahd-table-scroll { overflow-x: auto; }
.ahd-pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 12px; color: var(--ahd-muted); font-size: 14px; }
.ahd-reg-kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 16px; }
@media (max-width: 700px) { .ahd-reg-stats { grid-template-columns: 1fr; } .ahd-copy { flex-wrap: wrap; } }

/* ---------- Machine register & parts list ---------- */
.ahd-head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ahd-head-actions .ahd-btn svg { width: 16px; height: 16px; }
.ahd-reg-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ahd-reg-total { color: var(--ahd-muted); font-size: 14px; }
.ahd-reg-total strong { color: var(--ahd-ink); font-size: 16px; }
.ahd-brand-tabs .ahd-seg-btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; }
.ahd-seg-n { font-size: 12px; font-weight: 600; color: var(--ahd-muted); background: rgba(15,23,42,.06); border-radius: 999px; padding: 1px 8px; }
.ahd-seg-btn.is-active .ahd-seg-n { background: var(--ahd-accent-soft); color: var(--ahd-accent); }
.ahd-reg-search { flex: 1 1 320px; max-width: 460px; }
.ahd-reg-search .ahd-search { width: 100%; }
.ahd-reg-list { padding: 0; overflow: hidden; }
.ahd-reg-list .ahd-table { margin: 0; }
.ahd-reg-list .ahd-empty, .ahd-reg-list .ahd-pager, .ahd-reg-list .ahd-list-foot { padding: 20px; }
.ahd-table-click tbody tr { cursor: pointer; }
.ahd-table-click tbody tr:hover { background: #f8faf5; }
.ahd-table-click tbody tr:focus-visible { outline: 2px solid var(--ahd-accent); outline-offset: -2px; }
.ahd-row-edit { font-size: 13px; color: var(--ahd-accent); font-weight: 600; opacity: 0; }
.ahd-table-click tr:hover .ahd-row-edit, .ahd-table-click tr:focus .ahd-row-edit { opacity: 1; }
@media (hover: none) { .ahd-row-edit { opacity: 1; } }
.ahd-nowrap { white-space: nowrap; }
.ahd-list-foot { margin: 0; color: var(--ahd-muted); font-size: 13px; border-top: 1px solid var(--ahd-line); }
.ahd-empty-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.ahd-reg-import { margin-top: 28px; }
.ahd-reg-import > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 12px; }
.ahd-reg-import > summary::-webkit-details-marker { display: none; }
.ahd-reg-import > summary::before { content: ""; width: 9px; height: 9px; border-right: 2px solid var(--ahd-muted); border-bottom: 2px solid var(--ahd-muted); transform: rotate(-45deg); transition: transform .15s; flex: none; }
.ahd-reg-import[open] > summary::before { transform: rotate(45deg); }
.ahd-reg-import > summary > span { display: grid; gap: 2px; }
.ahd-reg-import[open] > summary { margin-bottom: 14px; }
.ahd-reg-sub { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--ahd-line); }
.ahd-reg-sub h3, .ahd-reg-way h3 { margin: 0 0 6px; font-size: 15px; color: var(--ahd-ink); }
.ahd-reg-way textarea { width: 100%; font: 13px/1.5 ui-monospace, Menlo, monospace; }

/* Pop-up form */
.ahd-dialog { width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 40px); padding: 0; border: 0; border-radius: 16px; box-shadow: 0 30px 80px rgba(15,23,42,.35); color: var(--ahd-ink, #0f172a); font-family: Inter, system-ui, sans-serif; }
.ahd-dialog-sm { width: min(480px, calc(100vw - 24px)); }
.ahd-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.ahd-dlg-form { display: flex; flex-direction: column; max-height: calc(100vh - 40px); margin: 0; }
.ahd-dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid #e2e8f0; }
.ahd-dlg-head h2 { margin: 0; font-size: 18px; }
.ahd-dlg-x { border: 0; background: none; font-size: 18px; cursor: pointer; color: #64748b; padding: 4px 8px; border-radius: 8px; }
.ahd-dlg-x:hover { background: #f1f5f9; color: #0f172a; }
.ahd-dlg-body { padding: 18px 22px; overflow-y: auto; }
.ahd-dlg-body .ahd-grid { margin-top: 4px; }
.ahd-dlg-foot { display: flex; align-items: center; gap: 8px; padding: 14px 22px; border-top: 1px solid #e2e8f0; background: #fafbfc; }
.ahd-dlg-del { color: #b42318; }
.ahd-dlg-del[hidden] { display: none; }
.ahd-dlg-more { margin-top: 12px; padding: 12px 14px; background: #f8fafc; border-radius: 10px; }
.ahd-dialog .ahd-field input, .ahd-dialog .ahd-field textarea, .ahd-dialog .ahd-field select { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 10px; font: inherit; font-size: 15px; background: #fff; }
.ahd-dialog .ahd-field input:focus, .ahd-dialog .ahd-field textarea:focus { outline: none; border-color: var(--ahd-accent, #5f7f00); box-shadow: 0 0 0 3px rgba(95,127,0,.15); }
.ahd-dialog .ahd-seg-sm input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ahd-dialog .ahd-label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.ahd-dialog .ahd-field { margin-bottom: 14px; }
@media (max-width: 600px) {
	.ahd-dialog, .ahd-dialog-sm { width: 100vw; max-width: 100vw; height: 100%; max-height: 100%; margin: 0; border-radius: 0; }
	.ahd-dlg-form { max-height: 100%; height: 100%; }
	.ahd-dlg-body { flex: 1; }
	.ahd-head-actions { width: 100%; }
	.ahd-head-actions .ahd-btn { flex: 1; justify-content: center; }
}

/* Parts on the ticket form */
.ahd-parts-add { position: relative; margin-bottom: 8px; }
.ahd-parts-search { width: 100%; }

/* Bulk delete */
.ahd-chk { width: 44px; padding-right: 0 !important; }
.ahd-chk input { width: 18px; height: 18px; margin: 0; cursor: pointer; accent-color: var(--ahd-accent); vertical-align: middle; }
.ahd-table-click tbody tr.is-picked { background: color-mix(in srgb, var(--ahd-accent) 7%, #fff); }
.ahd-bulk-bar { position: sticky; bottom: 12px; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 12px; padding: 10px 12px 10px 16px; background: #0f172a; color: #fff; border-radius: 12px; box-shadow: 0 12px 30px rgba(15,23,42,.3); font-size: 14px; }
.ahd-bulk-bar[hidden] { display: none; }
.ahd-bulk-count { font-weight: 600; }
.ahd-bulk-bar .ahd-link-btn { color: #cbd5e1; }
.ahd-bulk-bar .ahd-link-btn:hover { color: #fff; }
.ahd-bulk-bar .ahd-link-btn[hidden] { display: none; }
.ahd .ahd-btn-danger { background: #d92d20; border-color: #d92d20; color: #fff; }
.ahd .ahd-btn-danger:hover { background: #b42318; border-color: #b42318; }
.ahd .ahd-btn-danger svg { width: 16px; height: 16px; }
.ahd-dialog-lg { width: min(760px, calc(100vw - 24px)); }
.ahd-mfields[hidden] { display: none; }
.ahd-dlg-hist { margin-top: 6px; padding: 10px 14px; background: #f8fafc; border-radius: 10px; font-size: 14px; }
.ahd-dlg-hist[hidden] { display: none; }
.ahd-dlg-hist summary { cursor: pointer; font-weight: 600; }
.ahd-dlg-hist dl { margin: 10px 0 0; padding-top: 10px; border-top: 1px solid #e2e8f0; }
.ahd-reg-again { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 6px; background: #fef3e2; color: #b45309; font-size: 11px; font-weight: 700; vertical-align: 1px; }
.ahd-reg-hist { margin-top: 12px; font-size: 14px; }
.ahd-reg-hist summary { cursor: pointer; color: var(--ahd-muted); }
.ahd-reg-hist dl { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--ahd-line); }
.ahd-lay input[type=text] { width: 100%; min-width: 180px; }
.ahd-lay .ahd-help { display: block; margin-top: 2px; }
.ahd-lay-mv { border: 1px solid var(--ahd-line-strong); background: #fff; border-radius: 6px; width: 28px; height: 28px; cursor: pointer; margin-right: 4px; color: var(--ahd-muted); }
.ahd-lay-mv:hover { color: var(--ahd-ink); border-color: var(--ahd-accent); }
.ahd-lay-new { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.ahd-lay-new input[type=text] { flex: 1 1 220px; }

/* Machines not in the register */
.ahd-reg-miss { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: #fffaf0; border: 1px solid #f3d9a4; color: #5b4300; font-size: 13px; line-height: 1.45; }
.ahd-reg-miss[hidden] { display: none; }
.ahd-reg-near { margin-top: 6px; color: #5b4300; }
.ahd-reg-near .ahd-link-btn { color: #0f172a; font-weight: 700; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.ahd-reg-warn { display: grid; gap: 4px; margin-bottom: 16px; padding: 12px 14px; border-radius: 12px; background: #fffaf0; border: 1px solid #f3d9a4; color: #5b4300; font-size: 14px; }
.ahd-reg-warn.is-warranty { background: #fdecec; border-color: #f5b5b0; color: #8a1c13; }
.ahd-reg-warn a { font-weight: 600; }
.ahd-missing { border-color: #f3d9a4; background: #fffcf5; }
.ahd-missing .ahd-table { background: #fff; }
.ahd-inline { display: inline; margin: 0; }
.ahd-bi-machine::before { background-color: #fef3e2; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b45309' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M12 8v5M12 16.5v.5'/%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3C/svg%3E"); }
