/* ==========================================================================
   Aniket Personal CRM
   Everything is scoped to .apcrm-wrap. Business colour flows through --c.
   ========================================================================== */

.apcrm-wrap {
	--ink: #1d2433;
	--ink-2: #475069;
	--ink-3: #7a8299;
	--line: #e3e6ee;
	--line-2: #eef0f5;
	--paper: #ffffff;
	--wash: #f6f7fa;
	--brand: #2f3b59;
	--good: #12805c;
	--bad: #c4302b;
	--warn: #b36b00;
	--today: #2f5bd3;
	--radius: 8px;
	--c: #94a3b8;
	color: var(--ink);
	font-size: 14px;
	line-height: 1.45;
	max-width: 1440px;
}
.apcrm-wrap *,
.apcrm-wrap *::before,
.apcrm-wrap *::after { box-sizing: border-box; }
.apcrm-wrap a { color: var(--brand); }
.apcrm-wrap h1,
.apcrm-wrap h2,
.apcrm-wrap h3 { color: var(--ink); }
.apcrm-muted { color: var(--ink-3); }
.apcrm-sub { display: block; color: var(--ink-3); font-size: 12px; margin-top: 2px; overflow-wrap: anywhere; }
.apcrm-wrap .is-pos { color: var(--good); }
.apcrm-wrap .is-neg { color: var(--bad); }

/* ---------- Top bar & navigation ---------- */
.apcrm-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px;
	margin: 14px 0 12px;
}
.apcrm-brand { display: flex; align-items: center; gap: 12px; }
.apcrm-logo {
	width: 38px; height: 38px;
	border-radius: 10px;
	display: grid; place-items: center;
	color: #fff; font-weight: 700; font-size: 18px;
	background:
		linear-gradient(135deg, transparent 50%, rgba(255,255,255,.12) 50%),
		conic-gradient(from 45deg, #5b5bd6 0 25%, #e0962b 0 50%, #d64550 0 75%, #12998a 0);
	box-shadow: inset 0 0 0 3px var(--ink);
}
.apcrm-brand h1 { margin: 0; padding: 0; font-size: 22px; font-weight: 650; line-height: 1.2; }
.apcrm-brand small { color: var(--ink-3); }
.apcrm-top-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.apcrm-wrap .button .dashicons { font-size: 16px; width: 16px; height: 16px; vertical-align: -3px; margin-right: 3px; }

.apcrm-nav {
	display: flex;
	gap: 2px;
	overflow-x: auto;
	border-bottom: 1px solid var(--line);
	margin-bottom: 16px;
	scrollbar-width: thin;
}
.apcrm-nav a {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 9px 12px;
	color: var(--ink-2);
	text-decoration: none;
	white-space: nowrap;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
}
.apcrm-nav a .dashicons { font-size: 16px; width: 16px; height: 16px; color: var(--ink-3); }
.apcrm-nav a:hover { color: var(--ink); }
.apcrm-nav a.is-active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.apcrm-nav a.is-active .dashicons { color: var(--ink); }
.apcrm-nav a:focus { box-shadow: none; outline: 2px solid var(--today); outline-offset: -2px; }
.apcrm-wrap .wp-header-end { margin: 0; visibility: hidden; height: 0; border: 0; }

/* ---------- Banner / toolbar ---------- */
.apcrm-banner {
	display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
	background: #fff8e8; border: 1px solid #f1d9a6; border-radius: var(--radius);
	padding: 10px 14px; margin-bottom: 14px;
}
.apcrm-banner p { margin: 0; }
.apcrm-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.apcrm-toolbar .apcrm-bizbar { margin: 0; }

/* ---------- Business switcher ---------- */
.apcrm-bizbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.apcrm-biz {
	display: inline-flex; align-items: center; gap: 7px;
	padding: 5px 12px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: var(--paper);
	color: var(--ink-2) !important;
	text-decoration: none;
	font-weight: 500;
}
.apcrm-biz i, .apcrm-bizpill i {
	width: 8px; height: 8px; border-radius: 50%;
	background: var(--c); display: inline-block; flex: none;
}
.apcrm-biz:hover { border-color: var(--c); color: var(--ink) !important; }
.apcrm-biz.is-active { background: var(--ink); border-color: var(--ink); color: #fff !important; }
.apcrm-biz.is-active i { box-shadow: 0 0 0 2px #fff; }
.apcrm-bizpill {
	display: inline-flex; align-items: center; gap: 6px;
	font-size: 12px; font-weight: 500; white-space: nowrap;
	color: var(--ink-2); text-decoration: none;
}
a.apcrm-bizpill { color: var(--ink); font-weight: 600; font-size: 13px; }

/* ---------- Stat cards ---------- */
.apcrm-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
	gap: 10px;
	margin-bottom: 16px;
}
.apcrm-stat {
	display: flex; flex-direction: column; gap: 2px;
	padding: 14px 16px;
	background: var(--paper);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	text-decoration: none;
	color: var(--ink) !important;
	transition: border-color .15s;
}
a.apcrm-stat:hover { border-color: var(--ink-3); }
.apcrm-stat span { color: var(--ink-2); font-size: 13px; }
.apcrm-stat strong { font-size: 24px; font-weight: 650; line-height: 1.25; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.apcrm-stat small { color: var(--ink-3); font-size: 12px; }
.apcrm-stat.is-lead { background: var(--ink); border-color: var(--ink); color: #fff !important; }
.apcrm-stat.is-lead span, .apcrm-stat.is-lead small { color: #c9cfdd; }
.apcrm-stat.is-lead .is-pos { color: #7ee2b8; }
.apcrm-stat.is-lead .is-neg { color: #ffa29e; }
.apcrm-stat.is-warn { border-color: #f1d9a6; background: #fffbf1; }
.apcrm-stat.is-warn strong { color: var(--warn); }
.apcrm-stat.is-alert { border-color: #f3c3c1; background: #fff6f5; }
.apcrm-stat.is-alert strong { color: var(--bad); }

/* ---------- Panels ---------- */
.apcrm-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	gap: 12px;
	margin-bottom: 12px;
}
.apcrm-grid.is-two { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.apcrm-panel {
	background: var(--paper);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 14px 16px;
	margin-bottom: 12px;
	min-width: 0;
}
.apcrm-grid > .apcrm-panel { margin-bottom: 0; }
.apcrm-panel > header {
	display: flex; align-items: center; justify-content: space-between; gap: 8px;
	margin: -2px 0 10px;
}
.apcrm-panel h2 { font-size: 15px; font-weight: 650; margin: 0; display: flex; align-items: center; gap: 8px; }
.apcrm-panel h2 .dashicons { color: var(--ink-3); }
.apcrm-panel > header a { font-size: 13px; text-decoration: none; }
.apcrm-panel > p:last-child { margin-bottom: 0; }
.apcrm-count {
	display: inline-grid; place-items: center;
	min-width: 22px; height: 20px; padding: 0 6px;
	border-radius: 999px;
	background: var(--line-2); color: var(--ink-2);
	font-size: 12px; font-weight: 600;
}
.apcrm-panel.is-alert { border-top: 3px solid var(--bad); }
.apcrm-panel.is-alert .apcrm-count { background: #fde3e1; color: var(--bad); }
.apcrm-panel.is-today { border-top: 3px solid var(--today); }
.apcrm-panel.is-danger-zone { border-color: #f3c3c1; }

/* ---------- Item lists (dashboard) ---------- */
.apcrm-list { margin: 0; padding: 0; list-style: none; }
.apcrm-due-list { max-height: 420px; overflow-y: auto; }
.apcrm-item {
	display: flex; align-items: flex-start; gap: 10px;
	padding: 9px 4px 9px 12px;
	margin: 0;
	border-bottom: 1px solid var(--line-2);
	position: relative;
}
.apcrm-item::before {
	content: ""; position: absolute; left: 0; top: 9px; bottom: 9px;
	width: 3px; border-radius: 3px; background: var(--c);
}
.apcrm-item:last-child { border-bottom: 0; }
.apcrm-item-main { flex: 1; min-width: 0; }
.apcrm-item .apcrm-done { margin-top: 3px; }
.apcrm-item.is-done .apcrm-link,
.apcrm-item.is-done strong { text-decoration: line-through; color: var(--ink-3); }
.apcrm-item > .apcrm-money { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.apcrm-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px; font-size: 12px; }
.apcrm-tag { font-size: 11px; color: var(--ink-3); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.apcrm-empty { color: var(--ink-3); padding: 14px 4px; margin: 0; list-style: none; }

.apcrm-link {
	background: none; border: 0; padding: 0; margin: 0;
	font: inherit; font-weight: 600; color: var(--ink);
	text-align: left; cursor: pointer;
	overflow-wrap: anywhere;
}
.apcrm-link:hover { color: var(--today); text-decoration: underline; }
.apcrm-link:focus-visible { outline: 2px solid var(--today); outline-offset: 2px; border-radius: 2px; }

.apcrm-rel { font-size: 12px; color: var(--ink-2); display: inline-block; }
.apcrm-rel.is-overdue, .apcrm-date.is-overdue { color: var(--bad); font-weight: 600; }
.apcrm-rel.is-today, .apcrm-date.is-today { color: var(--today); font-weight: 600; }
td .apcrm-rel { display: block; }

.apcrm-snooze { display: flex; gap: 3px; flex: none; }
.apcrm-snooze button {
	border: 1px solid var(--line); background: var(--paper); color: var(--ink-2);
	border-radius: 5px; font-size: 11px; padding: 2px 6px; cursor: pointer; line-height: 1.5;
}
.apcrm-snooze button:hover { border-color: var(--ink-2); color: var(--ink); }

.apcrm-wa {
	display: inline-block; font-size: 10px; font-weight: 700; line-height: 1;
	padding: 3px 4px; border-radius: 4px; background: #e7f7ee; color: #128c4a !important;
	text-decoration: none; vertical-align: 1px;
}

/* ---------- Status badges & inline selects ---------- */
.apcrm-badge, .apcrm-pill {
	--b: var(--line-2); --f: var(--ink-2);
	background: var(--b); color: var(--f);
	border-radius: 999px;
	font-size: 12px; font-weight: 500;
	white-space: nowrap;
}
.apcrm-badge { display: inline-block; padding: 1px 9px; }
.apcrm-wrap select.apcrm-pill {
	border: 0; min-height: 26px; line-height: 1.6;
	padding: 1px 24px 1px 10px;
	background-color: var(--b);
	background-position: right 6px center;
	background-size: 12px;
	cursor: pointer;
	max-width: 100%;
}
.apcrm-wrap select.apcrm-pill:focus { box-shadow: 0 0 0 2px var(--today); }
.apcrm-wrap select.apcrm-pill.is-busy { opacity: .5; }

.s-urgent      { --b: #fde3e1; --f: #a3221e; }
.s-high        { --b: #ffeedd; --f: #9a4c00; }
.s-medium      { --b: #eef0f5; --f: #475069; }
.s-low         { --b: #f3f4f7; --f: #7a8299; }
.s-todo        { --b: #eef0f5; --f: #475069; }
.s-in_progress { --b: #e2eafd; --f: #2346a8; }
.s-waiting     { --b: #fff3d6; --f: #8a5a00; }
.s-done        { --b: #dff4ea; --f: #0f6d4d; }
.s-new         { --b: #e2eafd; --f: #2346a8; }
.s-contacted   { --b: #ede7fb; --f: #5a3aa8; }
.s-qualified   { --b: #e0f3f5; --f: #0d6b75; }
.s-proposal    { --b: #fff3d6; --f: #8a5a00; }
.s-negotiation { --b: #ffeedd; --f: #9a4c00; }
.s-won         { --b: #dff4ea; --f: #0f6d4d; }
.s-lost        { --b: #f3f4f7; --f: #7a8299; }
.s-active      { --b: #dff4ea; --f: #0f6d4d; }
.s-on_hold     { --b: #fff3d6; --f: #8a5a00; }
.s-inactive    { --b: #f3f4f7; --f: #7a8299; }
.s-planning    { --b: #ede7fb; --f: #5a3aa8; }
.s-completed   { --b: #dff4ea; --f: #0f6d4d; }
.s-cancelled   { --b: #f3f4f7; --f: #7a8299; }
.s-income      { --b: #dff4ea; --f: #0f6d4d; }
.s-expense     { --b: #fde3e1; --f: #a3221e; }
.s-paid        { --b: #dff4ea; --f: #0f6d4d; }
.s-pending     { --b: #fff3d6; --f: #8a5a00; }

/* ---------- Filters ---------- */
.apcrm-filters {
	display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
	margin-bottom: 10px;
}
.apcrm-search { position: relative; flex: 1 1 240px; max-width: 360px; }
.apcrm-search .dashicons { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.apcrm-wrap .apcrm-search input { width: 100%; padding-left: 32px; min-height: 32px; }
.apcrm-wrap .apcrm-filters select { min-height: 32px; max-width: 200px; }
.apcrm-inline-label { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.apcrm-clear { font-size: 13px; }
.apcrm-resultcount { color: var(--ink-3); margin: 0 0 6px; font-size: 12px; }

.apcrm-totals {
	display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
	margin-bottom: 12px;
}
.apcrm-totals > div { padding: 10px 14px; border-right: 1px solid var(--line-2); }
.apcrm-totals > div:last-child { border-right: 0; }
.apcrm-totals span { display: block; font-size: 12px; color: var(--ink-3); }
.apcrm-totals strong { font-size: 17px; font-variant-numeric: tabular-nums; }

/* ---------- Tables ---------- */
.apcrm-table-wrap {
	background: var(--paper);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	overflow-x: auto;
}
.apcrm-panel .apcrm-table-wrap { border: 0; border-radius: 0; margin: 0 -16px -14px; }
.apcrm-table { width: 100%; border-collapse: collapse; }
.apcrm-table th {
	text-align: left; font-weight: 600; font-size: 12px; color: var(--ink-2);
	padding: 9px 12px; background: var(--wash);
	border-bottom: 1px solid var(--line);
	white-space: nowrap;
}
.apcrm-table td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.apcrm-table tbody tr:last-child td { border-bottom: 0; }
.apcrm-table tbody tr:hover td { background: #fafbfd; }
.apcrm-list-table tbody tr[data-id] td:first-child { box-shadow: inset 3px 0 0 var(--c); }
.apcrm-list-table tr.is-done .apcrm-link { text-decoration: line-through; color: var(--ink-3); }
.apcrm-list-table tr.is-overdue td { background: #fffafa; }
.apcrm-list-table tr.is-flash td { animation: apcrm-flash 1.2s ease-out; }
@keyframes apcrm-flash { from { background: #fff4c7; } }
.apcrm-table .col-done { width: 28px; padding-right: 0; }
.apcrm-table .col-actions { width: 1%; white-space: nowrap; text-align: right; }
.apcrm-table .col-amount, .apcrm-table .col-deal_value, .apcrm-table .col-budget { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.apcrm-table td.col-amount .apcrm-money { font-weight: 600; }
.apcrm-table .col-title, .apcrm-table .col-name, .apcrm-table .col-description { min-width: 200px; }
.apcrm-empty-row td { text-align: center; color: var(--ink-3); padding: 36px 12px !important; }
.apcrm-sumtable tr td:first-child { box-shadow: inset 3px 0 0 var(--c); }

.apcrm-sort { color: var(--ink-2) !important; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.apcrm-sort:hover { color: var(--ink) !important; }
.apcrm-sort-ico { width: 0; height: 0; border: 4px solid transparent; opacity: .35; border-top-color: currentColor; margin-top: 4px; }
.apcrm-sort.is-sorted { color: var(--ink) !important; }
.apcrm-sort.is-sorted .apcrm-sort-ico { opacity: 1; }
.apcrm-sort.is-asc .apcrm-sort-ico { border-top-color: transparent; border-bottom-color: currentColor; margin-top: -4px; }

.apcrm-actions { display: inline-flex; gap: 2px; }
.apcrm-icon {
	display: inline-grid; place-items: center;
	width: 30px; height: 30px; border-radius: 6px;
	border: 0; background: none; color: var(--ink-3) !important;
	cursor: pointer; text-decoration: none;
}
.apcrm-icon:hover { background: var(--line-2); color: var(--ink) !important; }
.apcrm-icon.is-danger:hover { background: #fde3e1; color: var(--bad) !important; }
.apcrm-icon .dashicons { font-size: 17px; width: 17px; height: 17px; }

.apcrm-pagination { margin: 12px 0; display: flex; gap: 4px; flex-wrap: wrap; }
.apcrm-pagination .page-numbers {
	display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px;
	border: 1px solid var(--line); border-radius: 6px; background: var(--paper); text-decoration: none;
}
.apcrm-pagination .page-numbers.current { background: var(--ink); border-color: var(--ink); color: #fff; }
.apcrm-pagination .page-numbers.dots { border: 0; background: none; }

/* ---------- Modal ---------- */
.apcrm-modal { position: fixed; inset: 0; z-index: 100000; display: grid; place-items: center; padding: 20px; }
.apcrm-modal[hidden] { display: none; }
.apcrm-modal-backdrop { position: absolute; inset: 0; background: rgba(20, 25, 38, .55); }
.apcrm-modal-box {
	position: relative; width: 100%; max-width: 620px; max-height: calc(100vh - 40px);
	overflow: auto; background: var(--paper); border-radius: 12px;
	box-shadow: 0 20px 60px rgba(0,0,0,.25);
	border-top: 4px solid var(--c);
	animation: apcrm-pop .16s ease-out;
}
@keyframes apcrm-pop { from { transform: translateY(8px); opacity: 0; } }
.apcrm-modal-box form > header {
	display: flex; align-items: center; justify-content: space-between;
	padding: 14px 20px; border-bottom: 1px solid var(--line-2);
	position: sticky; top: 0; background: var(--paper); z-index: 1;
}
.apcrm-modal-box h2 { margin: 0; font-size: 17px; }
.apcrm-x { border: 0; background: none; font-size: 26px; line-height: 1; color: var(--ink-3); cursor: pointer; padding: 0 4px; }
.apcrm-x:hover { color: var(--ink); }
.apcrm-modal .apcrm-form-grid { padding: 16px 20px; }
.apcrm-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.apcrm-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.apcrm-field.is-full, .apcrm-check.is-full { grid-column: 1 / -1; }
.apcrm-field > span { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.apcrm-field em { color: var(--bad); font-style: normal; }
.apcrm-wrap .apcrm-field input,
.apcrm-wrap .apcrm-field select,
.apcrm-wrap .apcrm-field textarea { width: 100%; max-width: none; min-height: 34px; }
.apcrm-wrap .apcrm-field input[type="color"] { padding: 2px; height: 34px; }
.apcrm-check { display: flex; align-items: center; gap: 6px; }
.apcrm-modal-box footer, .apcrm-form-inline footer {
	display: flex; justify-content: flex-end; gap: 8px;
	padding: 12px 20px; border-top: 1px solid var(--line-2);
	position: sticky; bottom: 0; background: var(--paper);
}
.apcrm-form-inline footer { padding: 12px 0 0; position: static; border: 0; }
.apcrm-form.is-busy button[type="submit"] { opacity: .6; pointer-events: none; }
.apcrm-form-error { grid-column: 1 / -1; background: #fde3e1; color: #7d1a17; padding: 8px 10px; border-radius: 6px; margin: 0; }
body.apcrm-modal-open { overflow: hidden; }

/* ---------- Toasts ---------- */
#apcrm-toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100001; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.apcrm-toast {
	background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px;
	box-shadow: 0 8px 24px rgba(0,0,0,.2); font-size: 13px; max-width: 360px;
	animation: apcrm-pop .16s ease-out; pointer-events: auto;
}
.apcrm-toast.is-error { background: var(--bad); }
.apcrm-toast.is-out { opacity: 0; transform: translateY(6px); transition: .25s; }

/* ---------- Calendar ---------- */
.apcrm-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: var(--paper); }
.apcrm-seg a { padding: 6px 12px; color: var(--ink-2) !important; text-decoration: none; border-right: 1px solid var(--line); display: inline-flex; align-items: center; gap: 5px; }
.apcrm-seg a:last-child { border-right: 0; }
.apcrm-seg a.is-active { background: var(--ink); color: #fff !important; }
.apcrm-seg .dashicons { font-size: 15px; width: 15px; height: 15px; }
.apcrm-legend { display: flex; gap: 12px; color: var(--ink-3); font-size: 12px; }
.apcrm-legend span { display: inline-flex; align-items: center; gap: 3px; }
.apcrm-legend .dashicons { font-size: 14px; width: 14px; height: 14px; }

.apcrm-cal { padding: 14px 0 0; }
.apcrm-cal > header { padding: 0 16px; }
.apcrm-cal h2 { font-size: 18px; }
.apcrm-cal-nav { display: flex; gap: 4px; }
.apcrm-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.apcrm-cal-dow { padding: 6px 8px; font-size: 12px; font-weight: 600; color: var(--ink-3); background: var(--wash); border-bottom: 1px solid var(--line); }
.apcrm-cal-day {
	min-height: 112px; padding: 4px 5px 6px;
	border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2);
	display: flex; flex-direction: column; gap: 3px; min-width: 0;
}
.apcrm-cal-day:nth-child(7n) { border-right: 0; }
.apcrm-cal-day.is-out { background: #fbfbfd; }
.apcrm-cal-day.is-out .apcrm-cal-date { color: #b7bccb; }
.apcrm-cal-date { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 2px 3px; }
.apcrm-cal-wd { display: none; }
.apcrm-cal-day.is-today { background: #f3f6ff; }
.apcrm-cal-day.is-today .apcrm-cal-date { color: var(--today); }
.apcrm-cal-add {
	border: 0; background: none; color: var(--ink-3); cursor: pointer;
	width: 20px; height: 20px; border-radius: 4px; font-size: 15px; line-height: 1; opacity: 0;
}
.apcrm-cal-day:hover .apcrm-cal-add, .apcrm-cal-add:focus { opacity: 1; }
.apcrm-cal-add:hover { background: var(--line-2); color: var(--ink); }

.apcrm-ev {
	display: flex; align-items: center; gap: 4px; width: 100%;
	border: 0; border-left: 3px solid var(--c); border-radius: 4px;
	background: color-mix(in srgb, var(--c) 10%, #fff);
	color: var(--ink); font-size: 12px; line-height: 1.3; text-align: left;
	padding: 3px 5px; cursor: pointer;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@supports not (background: color-mix(in srgb, red 10%, white)) { .apcrm-ev { background: var(--wash); } }
.apcrm-ev .dashicons { font-size: 13px; width: 13px; height: 13px; flex: none; color: var(--c); }
.apcrm-ev:hover { filter: brightness(.96); }
.apcrm-ev.is-done { opacity: .5; text-decoration: line-through; }
.apcrm-ev.is-overdue { box-shadow: inset 0 0 0 1px #f3c3c1; }
.apcrm-ev.t-project { font-weight: 600; }
.apcrm-agenda .apcrm-ev { width: auto; max-width: 100%; font-size: 13px; padding: 5px 8px; }

.apcrm-agenda-day { padding: 8px 0; border-top: 1px solid var(--line-2); }
.apcrm-agenda > header + .apcrm-agenda-day { border-top: 0; }
.apcrm-agenda-day h3 { margin: 0 0 6px; font-size: 13px; font-weight: 650; }
.apcrm-agenda-day h3 small { color: var(--ink-3); font-weight: 400; margin-left: 6px; }
.apcrm-agenda-day.is-today h3 { color: var(--today); }
.apcrm-agenda-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 3px 0; }

/* ---------- Team / tools ---------- */
.apcrm-yes { color: var(--good); }
.apcrm-counts { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 14px; padding: 0; list-style: none; color: var(--ink-2); }
.apcrm-counts strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.apcrm-radios { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; border: 0; padding: 0; }
.apcrm-radios label { color: var(--ink-2); }
.apcrm-wrap .button.apcrm-btn-danger { color: var(--bad); border-color: var(--bad); }
.apcrm-wrap .apcrm-role { min-height: 30px; }

/* ---------- Front-end (shortcode page) ---------- */
.apcrm-front { max-width: 1200px; margin: 0 auto; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; }
.apcrm-front ul { margin: 0; }
.apcrm-front .button {
	display: inline-block; padding: 7px 14px; border-radius: 6px;
	border: 1px solid var(--ink); background: var(--paper); color: var(--ink);
	text-decoration: none; font-size: 14px; line-height: 1.4;
}
.apcrm-front .button-primary { background: var(--ink); color: #fff !important; }
.apcrm-gate { max-width: 420px; margin: 40px auto; }
.apcrm-gate input[type="text"], .apcrm-gate input[type="password"] { width: 100%; padding: 8px; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
	.apcrm-cal-day { min-height: 92px; }
	.apcrm-ev .dashicons { display: none; }
}

@media (max-width: 782px) {
	.apcrm-wrap { font-size: 15px; }
	.apcrm-top { margin-top: 8px; }
	.apcrm-top-actions { width: 100%; }
	.apcrm-top-actions .button { flex: 1 1 auto; text-align: center; }
	.apcrm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.apcrm-stat strong { font-size: 20px; }
	.apcrm-grid, .apcrm-grid.is-two { grid-template-columns: 1fr; }
	.apcrm-bizbar { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
	.apcrm-biz { white-space: nowrap; }
	.apcrm-search { max-width: none; flex-basis: 100%; }
	.apcrm-wrap .apcrm-filters select { flex: 1 1 45%; max-width: none; }

	/* Tables turn into cards */
	.apcrm-table-wrap { background: none; border: 0; overflow: visible; }
	.apcrm-panel .apcrm-table-wrap { margin: 0; }
	.apcrm-table thead { display: none; }
	.apcrm-table, .apcrm-table tbody, .apcrm-table tr, .apcrm-table td { display: block; width: 100%; }
	.apcrm-table tr[data-id], .apcrm-table tr[data-user], .apcrm-sumtable tr, .apcrm-roles-table tr {
		background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
		margin-bottom: 8px; padding: 8px 12px; position: relative;
		box-shadow: inset 4px 0 0 var(--c);
	}
	.apcrm-roles-table tr, .apcrm-users-table tr { box-shadow: none; }
	.apcrm-list-table tbody tr[data-id] td:first-child, .apcrm-sumtable tr td:first-child { box-shadow: none; }
	.apcrm-table td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right; }
	.apcrm-table td::before { content: attr(data-label); color: var(--ink-3); font-size: 13px; text-align: left; flex: none; }
	.apcrm-table td[data-label=""]::before { content: none; }
	.apcrm-table td.col-title, .apcrm-table td.col-name, .apcrm-table td.col-description,
	.apcrm-sumtable td:first-child, .apcrm-users-table td:first-child, .apcrm-roles-table td:first-child { display: block; text-align: left; padding-right: 90px; }
	.apcrm-table td.col-title::before, .apcrm-table td.col-name::before, .apcrm-table td.col-description::before,
	.apcrm-sumtable td:first-child::before, .apcrm-users-table td:first-child::before, .apcrm-roles-table td:first-child::before { content: none; }
	.apcrm-table td.col-done { position: absolute; left: 12px; top: 12px; width: auto; }
	.apcrm-list-table[data-entity="task"] td.col-title { padding-left: 30px; }
	.apcrm-table td.col-actions { position: absolute; right: 6px; top: 6px; width: auto; }
	.apcrm-table td.col-actions::before { content: none; }
	.apcrm-table tbody tr:hover td { background: none; }
	.apcrm-list-table tr.is-overdue { border-color: #f3c3c1; }
	.apcrm-empty-row { border: 1px dashed var(--line); border-radius: var(--radius); }
	.apcrm-empty-row td { display: block; text-align: center; }
	.apcrm-empty-row td::before { content: none; }

	/* Modal becomes a bottom sheet */
	.apcrm-modal { padding: 0; align-items: end; }
	.apcrm-modal-box { max-width: none; max-height: 92vh; border-radius: 14px 14px 0 0; animation-name: apcrm-sheet; }
	@keyframes apcrm-sheet { from { transform: translateY(40px); opacity: .4; } }
	.apcrm-form-grid { grid-template-columns: 1fr; }
	.apcrm-wrap .apcrm-field input, .apcrm-wrap .apcrm-field select, .apcrm-wrap .apcrm-field textarea { min-height: 42px; font-size: 16px; }
	.apcrm-modal-box footer .button { flex: 1; min-height: 42px; }
	#apcrm-toasts { left: 12px; right: 12px; bottom: 12px; }
	.apcrm-toast { max-width: none; }

	/* Calendar collapses to a list of busy days */
	.apcrm-cal-grid { display: block; }
	.apcrm-cal-dow, .apcrm-cal-day.is-empty, .apcrm-cal-day.is-out { display: none; }
	.apcrm-cal-day { min-height: 0; border-right: 0; padding: 8px 14px; }
	.apcrm-cal-day.is-today { display: flex; }
	.apcrm-cal-wd { display: inline; margin-right: 6px; font-weight: 400; color: var(--ink-3); }
	.apcrm-cal-add { opacity: 1; }
	.apcrm-ev { font-size: 14px; padding: 7px 8px; }
	.apcrm-ev .dashicons { display: inline-block; }
	.apcrm-legend { display: none; }
	.apcrm-item { padding-right: 0; flex-wrap: wrap; }
	.apcrm-snooze { width: 100%; padding-left: 0; }
	.apcrm-snooze button { flex: 1; padding: 6px; font-size: 12px; }
	.apcrm-totals > div { border-right: 0; border-bottom: 1px solid var(--line-2); }
}
