/* ==========================================================================
   Feature styles (modal, profile, CRM). Everything is scoped under .ag-* so it never touches the
   Elementor design. Colors come from Settings > Site features (--ag-brand); text uses the site font.
   ========================================================================== */
:root {
	--ag-brand: #E01317;
	--ag-brand-d: #B80F13;
	--ag-ink: #111318;
	--ag-muted: #5B6070;
	--ag-line: #E6E8EE;
	--ag-bg: #F6F7F9;
	--ag-tint: #FDECEC;
	--ag-white: #fff;
}

.ag-profile, .ag-modal { font-family: inherit; color: var(--ag-ink); line-height: 1.6; box-sizing: border-box; }
.ag-profile *, .ag-modal * { box-sizing: border-box; }
.ag-profile .screen-reader-text, .ag-modal .screen-reader-text { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; white-space: nowrap; }
.ag-ico { flex: none; }

/* ---------- buttons ---------- */
.ag-profile .ag-btn, .ag-modal .ag-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: .5em; padding: .8em 1.6em; border: 2px solid var(--ag-brand);
	border-radius: 12px; background: var(--ag-brand); color: #fff; font-weight: 700; font-size: 15px; line-height: 1.4; font-family: inherit; text-decoration: none; cursor: pointer;
	transition: background-color .15s, color .15s, border-color .15s;
}
.ag-profile .ag-btn:hover, .ag-modal .ag-btn:hover, .ag-profile .ag-btn:focus-visible, .ag-modal .ag-btn:focus-visible { background: var(--ag-brand-d); border-color: var(--ag-brand-d); color: #fff; }
.ag-profile .ag-btn--ghost { background: transparent; color: var(--ag-ink); border-color: #C9CCD6; }
.ag-profile .ag-btn--ghost:hover, .ag-profile .ag-btn--ghost:focus-visible { background: var(--ag-ink); border-color: var(--ag-ink); color: #fff; }
.ag-profile .ag-btn--sm { padding: .55em 1.1em; font-size: 14px; }
.ag-profile .ag-btn--block, .ag-modal .ag-btn { width: 100%; }
.ag-profile .ag-btn[disabled], .ag-modal .ag-btn[disabled] { opacity: .6; cursor: progress; }
.ag-linkbtn { padding: 0; border: 0; background: none; color: var(--ag-brand); font-weight: 600; font-size: 14px; line-height: 1.5; font-family: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.ag-linkbtn:hover { color: var(--ag-brand-d); }

/* ---------- form fields ---------- */
.ag-f { display: grid; gap: 6px; margin: 0 0 16px; }
.ag-f > span { font-size: 14px; font-weight: 600; }
.ag-f input, .ag-f textarea, .ag-f select {
	width: 100%; padding: .75em .9em; border: 1.5px solid #C9CCD6; border-radius: 10px; background: #fff; color: var(--ag-ink);
	font-weight: 400; font-size: 16px; line-height: 1.5; font-family: inherit; transition: border-color .15s, box-shadow .15s;
}
.ag-f textarea { resize: vertical; min-height: 6em; }
.ag-f input:focus, .ag-f textarea:focus { outline: none; border-color: var(--ag-brand); box-shadow: 0 0 0 4px rgba(224, 19, 23, .16); }
.ag-f.is-bad input, .ag-f.is-bad textarea { border-color: var(--ag-brand); background: #FFF7F7; }
.ag-f small { color: var(--ag-muted); font-size: 13px; }
.ag-check { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; font-size: 14px; cursor: pointer; }
.ag-check input { width: 18px; height: 18px; accent-color: var(--ag-brand); }
.ag-check.is-bad { color: var(--ag-brand); }
.ag-hp { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); opacity: 0; pointer-events: none; }
.ag-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }

/* ---------- login / registration modal ---------- */
html.ag-modal-open { overflow: hidden; }
.ag-modal { position: fixed; inset: 0; z-index: 100000; display: grid; place-items: center; padding: 16px; }
.ag-modal[hidden] { display: none; }
.ag-modal__backdrop { position: absolute; inset: 0; background: rgba(17, 19, 24, .6); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: ag-fade .2s ease-out; }
.ag-modal__box {
	position: relative; width: min(100%, 440px); max-height: calc(100vh - 32px); overflow: auto; padding: 36px 32px 28px; border-radius: 24px; background: #fff;
	box-shadow: 0 40px 80px -30px rgba(17, 19, 24, .6); animation: ag-pop .25s ease-out;
}
.ag-modal__x { position: absolute; top: 12px; inset-inline-end: 14px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--ag-bg); color: var(--ag-ink); font-size: 24px; line-height: 1; cursor: pointer; }
.ag-modal__x:hover { background: var(--ag-tint); color: var(--ag-brand); }
.ag-modal__title { margin: 0 0 18px; font-size: 26px; font-weight: 800; line-height: 1.2; letter-spacing: -.5px; color: var(--ag-ink); }
.ag-modal__tabs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; margin-bottom: 22px; padding: 4px; border-radius: 12px; background: var(--ag-bg); }
.ag-modal__tabs[hidden] { display: none; }
.ag-modal__tabs button { padding: .6em 1em; border: 0; border-radius: 9px; background: transparent; color: var(--ag-muted); font-weight: 700; font-size: 14px; line-height: 1.4; font-family: inherit; cursor: pointer; }
.ag-modal__tabs button.is-active { background: #fff; color: var(--ag-ink); box-shadow: 0 2px 8px rgba(17, 19, 24, .1); }
.ag-modal .ag-form[hidden] { display: none; }
.ag-modal .ag-form__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.ag-modal .ag-form__row .ag-check { margin: 0; }
.ag-form__alt { margin: 18px 0 0; text-align: center; color: var(--ag-muted); font-size: 14px; }
.ag-form__hint { margin: 0 0 16px; color: var(--ag-muted); font-size: 14px; }
.ag-form__msg { margin: 0 0 16px; padding: 12px 14px; border-radius: 10px; border-inline-start: 4px solid; font-size: 14px; }
.ag-form__msg[hidden] { display: none; }
.ag-form__msg.is-err { background: #FDECE9; color: #8A1C10; border-color: #E5483A; }
.ag-form__msg.is-ok { background: #E4F6EC; color: #0B5B34; border-color: #1FA464; }
@keyframes ag-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ag-pop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- profile ---------- */
.ag-profile { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 28px; align-items: start; }
.ag-profile--guest { display: block; max-width: 520px; margin-inline: auto; }
.ag-card { padding: 26px; border: 1px solid var(--ag-line); border-radius: 22px; background: #fff; margin: 0 0 20px; }
.ag-profile__side { position: sticky; top: 100px; padding: 26px 22px; border: 1px solid var(--ag-line); border-radius: 26px; background: #fff; box-shadow: 0 30px 50px -36px rgba(17, 19, 24, .35); }
.ag-profile__id { display: grid; justify-items: start; gap: 4px; padding-bottom: 18px; margin-bottom: 14px; border-bottom: 1px solid var(--ag-line); }
.ag-avatar { display: grid; place-items: center; width: 84px; height: 84px; margin-bottom: 8px; border-radius: 50%; overflow: hidden; background: linear-gradient(135deg, var(--ag-brand), var(--ag-brand-d)); color: #fff; box-shadow: 0 12px 24px -10px rgba(224, 19, 23, .55); }
.ag-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ag-avatar img[hidden], .ag-initials[hidden] { display: none; }
.ag-initials { font-size: 30px; font-weight: 800; letter-spacing: 0; line-height: 1; }
.ag-avatar--lg { width: 96px; height: 96px; }
.ag-avatar--lg .ag-initials { font-size: 34px; }
.ag-avatar svg { width: 36px; height: 36px; }
.ag-profile__name { font-size: 20px; font-weight: 800; line-height: 1.3; letter-spacing: -.3px; }
.ag-profile__mail { color: var(--ag-muted); font-size: 14px; word-break: break-all; }
.ag-chip { display: inline-block; margin-top: 6px; padding: 2px 12px; border-radius: 99px; background: var(--ag-tint); color: var(--ag-brand); font-size: 12px; font-weight: 700; }
.ag-profile__nav { display: grid; gap: 4px; margin-bottom: 18px; }
.ag-tab { display: flex; align-items: center; gap: 12px; width: 100%; padding: .7em .9em; border: 0; border-radius: 12px; background: transparent; color: var(--ag-ink); font-weight: 600; font-size: 15px; line-height: 1.4; font-family: inherit; text-align: start; cursor: pointer; transition: background-color .15s, color .15s; }
.ag-tab:hover { background: var(--ag-bg); }
.ag-tab.is-active { background: var(--ag-tint); color: var(--ag-brand); }
.ag-badge { margin-inline-start: auto; min-width: 22px; padding: 0 7px; border-radius: 99px; background: var(--ag-brand); color: #fff; font-weight: 700; font-size: 12px; line-height: 22px; font-family: inherit; text-align: center; font-style: normal; }

.ag-h { margin: 0 0 6px; font-size: clamp(26px, 3vw, 34px); font-weight: 800; line-height: 1.2; letter-spacing: -.8px; color: var(--ag-ink); }
.ag-h3 { margin: 28px 0 12px; font-size: 20px; font-weight: 800; line-height: 1.3; color: var(--ag-ink); }
.ag-card .ag-h3:first-child { margin-top: 0; }
.ag-sub { margin: 0 0 18px; color: var(--ag-muted); font-size: 15px; }
.ag-empty { color: var(--ag-muted); }
.ag-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.ag-guest { text-align: center; justify-items: center; display: grid; padding: 40px 30px; }
.ag-guest .ag-avatar { margin-inline: auto; }

.ag-panel[hidden] { display: none; }
.ag-toast { position: sticky; top: 90px; z-index: 5; margin-bottom: 18px; padding: 13px 16px; border-radius: 12px; border-inline-start: 4px solid; font-size: 15px; box-shadow: 0 14px 30px -18px rgba(17, 19, 24, .4); }
.ag-toast[hidden] { display: none; }
.ag-toast.is-ok { background: #E4F6EC; color: #0B5B34; border-color: #1FA464; }
.ag-toast.is-err { background: #FDECE9; color: #8A1C10; border-color: #E5483A; }

.ag-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 22px 0 8px; }
.ag-stat { padding: 20px 22px; border: 1px solid var(--ag-line); border-radius: 20px; background: #fff; }
.ag-stat strong { display: block; font-size: 30px; font-weight: 800; line-height: 1.15; letter-spacing: -1px; }
.ag-stat span { color: var(--ag-muted); font-size: 14px; }
.ag-stat.is-alert { background: var(--ag-tint); border-color: #F7C3C4; }
.ag-stat.is-alert strong { color: var(--ag-brand); }

.ag-avatar-card { display: flex; align-items: center; gap: 22px; }
.ag-avatar-card .ag-avatar { margin: 0; flex: none; }
.ag-avatar-card p { margin: 2px 0 12px; }

.ag-switch { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; cursor: pointer; }
.ag-switch input { position: absolute; opacity: 0; }
.ag-switch__ui { position: relative; flex: none; width: 46px; height: 26px; margin-top: 2px; border-radius: 99px; background: #C9CCD6; transition: background-color .2s; }
.ag-switch__ui::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .25); transition: transform .2s; }
.ag-switch input:checked + .ag-switch__ui { background: var(--ag-brand); }
.ag-switch input:checked + .ag-switch__ui::after { transform: translateX(20px); }
[dir="rtl"] .ag-switch input:checked + .ag-switch__ui::after { transform: translateX(-20px); }
.ag-switch input:focus-visible + .ag-switch__ui { box-shadow: 0 0 0 4px rgba(224, 19, 23, .25); }
.ag-switch small { display: block; color: var(--ag-muted); font-size: 14px; }

/* ---------- CRM: project list, phases, timeline ---------- */
.ag-st { display: inline-block; padding: 0 .85em; border: 1.5px solid var(--ag-ink); border-radius: 99px; font-size: 12.5px; font-weight: 700; line-height: 1.9; white-space: nowrap; color: var(--ag-ink); }
.ag-st--done, .ag-st--delivered { background: var(--ag-ink); border-color: var(--ag-ink); color: #fff; }
.ag-st--active { background: var(--ag-brand); border-color: var(--ag-brand); color: #fff; }
.ag-st--hold, .ag-st--waiting { background: #fff; border: 1.5px dashed var(--ag-brand); color: var(--ag-brand); }
.ag-st--pending, .ag-st--planning { border-color: #9AA0B2; color: var(--ag-muted); }
.ag-st--paused { background: var(--ag-line); border-color: var(--ag-line); }
.ag-bar { display: block; flex: 1; height: 10px; border-radius: 99px; background: var(--ag-line); overflow: hidden; }
.ag-bar i { display: block; height: 100%; border-radius: 99px; background: var(--ag-brand); }
.ag-bar--lg { height: 16px; }

.ag-plist { display: grid; gap: 14px; margin: 18px 0 0; padding: 0; list-style: none; }
.ag-prow { display: grid; gap: 8px; width: 100%; padding: 22px 24px; border: 1px solid var(--ag-line); border-radius: 22px; background: #fff; color: var(--ag-ink); font-family: inherit; text-align: start; cursor: pointer; transition: transform .2s, box-shadow .2s, border-color .2s; }
.ag-prow:hover { transform: translateY(-3px); border-color: #F0A6A8; box-shadow: 0 22px 40px -26px rgba(17, 19, 24, .35); }
.ag-prow__top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.ag-prow__title { font-size: 20px; font-weight: 800; line-height: 1.3; }
.ag-prow__facts { display: flex; flex-wrap: wrap; gap: 2px 22px; color: var(--ag-muted); font-size: 14.5px; }
.ag-prow__meter { display: flex; align-items: center; gap: 14px; }
.ag-prow__meter strong { min-width: 3em; font-size: 17px; }

.ag-back { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 18px; padding: 0; border: 0; background: none; color: var(--ag-brand); font-weight: 700; font-size: 15px; line-height: 1.4; font-family: inherit; cursor: pointer; }
.ag-back svg { width: 18px; height: 18px; }
[dir="rtl"] .ag-back svg { transform: scaleX(-1); }
.ag-pdetail[hidden], [data-ag-list][hidden] { display: none; }
.ag-pdetail__head { margin-bottom: 8px; padding-bottom: 26px; border-bottom: 1px solid var(--ag-line); }
.ag-facts { display: flex; flex-wrap: wrap; gap: 14px 44px; margin: 18px 0 24px; }
.ag-facts dt { color: var(--ag-muted); font-size: 13px; }
.ag-facts dd { margin: 0; font-weight: 700; }
.ag-meter { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px clamp(18px, 4vw, 40px); }
.ag-meter__pct { font-size: clamp(54px, 8vw, 84px); font-weight: 800; line-height: 1; letter-spacing: -3px; }
.ag-meter__pct small { font-size: .4em; letter-spacing: 0; margin-inline-start: .08em; }
.ag-meter .ag-sub { margin: 10px 0 0; }
.ag-note { margin: 20px 0 0; padding: 14px 16px; border-radius: 12px; border-inline-start: 4px solid; font-size: 15px; }
.ag-note--warn { background: var(--ag-tint); border-color: var(--ag-brand); color: #7A0C0F; }

.ag-phases { margin: 0; padding: 0; list-style: none; }
.ag-phase { position: relative; padding-inline-start: 58px; }
.ag-phase::before { content: ""; position: absolute; inset-inline-start: 17px; top: 56px; bottom: -14px; width: 2px; background: var(--ag-line); }
.ag-phase:last-child::before { display: none; }
.ag-phase details { border-top: 1px solid var(--ag-line); }
.ag-phase:last-child details { border-bottom: 1px solid var(--ag-line); }
.ag-phase summary { display: flex; align-items: center; gap: 16px; padding: 20px 0; list-style: none; cursor: pointer; }
.ag-phase summary::-webkit-details-marker { display: none; }
.ag-phase__mark { position: absolute; inset-inline-start: 0; top: 19px; display: grid; place-items: center; width: 36px; height: 36px; border: 2px solid var(--ag-ink); border-radius: 10px; background: #fff; font-weight: 800; line-height: 1; }
.ag-phase__mark svg { width: 18px; height: 18px; stroke-width: 3; }
.ag-phase.is-active .ag-phase__mark { background: var(--ag-brand); border-color: var(--ag-brand); color: #fff; }
.ag-phase.is-hold .ag-phase__mark { border-style: dashed; border-color: var(--ag-brand); color: var(--ag-brand); }
.ag-phase.is-done .ag-phase__mark { background: var(--ag-ink); color: #fff; }
.ag-phase__main { flex: 1; min-width: 0; }
.ag-phase__title { display: block; font-size: 19px; font-weight: 800; line-height: 1.4; }
.ag-phase__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 14px; color: var(--ag-muted); font-size: 14px; }
.ag-phase__pct { font-weight: 800; }
.ag-plus { position: relative; flex: none; width: 34px; height: 34px; border: 1.5px solid var(--ag-ink); border-radius: 50%; }
.ag-plus::before, .ag-plus::after { content: ""; position: absolute; top: 50%; left: 50%; width: 13px; height: 2px; margin: -1px 0 0 -6.5px; background: var(--ag-ink); transition: transform .2s; }
.ag-plus::after { transform: rotate(90deg); }
.ag-phase details[open] .ag-plus { background: var(--ag-brand); border-color: var(--ag-brand); }
.ag-phase details[open] .ag-plus::before, .ag-phase details[open] .ag-plus::after { background: #fff; }
.ag-phase details[open] .ag-plus::after { transform: rotate(0); }
.ag-phase__body { padding: 0 0 24px; max-width: 46em; animation: ag-fade .25s ease-out; }
.ag-steps { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.ag-steps li { display: flex; align-items: flex-start; gap: 12px; }
.ag-steps__box { flex: none; width: 22px; height: 22px; margin-top: 3px; border: 2px solid var(--ag-ink); border-radius: 6px; }
.ag-steps .is-done .ag-steps__box { background: var(--ag-brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 72% no-repeat; border-color: var(--ag-brand); }
.ag-steps .is-done .ag-steps__title { color: var(--ag-muted); }
.ag-steps small { display: block; color: var(--ag-muted); font-size: 13px; }
.ag-steps__note { display: block; color: var(--ag-muted); font-size: 14.5px; }
.ag-tag-you { display: inline-block; margin-inline-start: 8px; padding: 0 .75em; border-radius: 99px; background: var(--ag-brand); color: #fff; font-size: 12px; font-weight: 700; line-height: 1.8; }

.ag-log { margin: 14px 0 0; padding: 0; list-style: none; }
.ag-log li { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 4px 22px; padding: 14px 0; border-top: 1px solid var(--ag-line); }
.ag-log li:last-child { border-bottom: 1px solid var(--ag-line); }
.ag-log time { color: var(--ag-muted); font-size: 14px; }
.ag-log__msg span, .ag-log__client_msg span { padding-inline-start: 12px; border-inline-start: 3px solid var(--ag-brand); }
.ag-log__client_msg span { border-color: var(--ag-ink); }
.ag-msgform { margin-top: 8px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
	.ag-profile { grid-template-columns: minmax(0, 1fr); }
	.ag-profile__side { position: static; }
	.ag-profile__nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
	.ag-tab { width: auto; flex: none; white-space: nowrap; }
	.ag-stats { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
	.ag-grid2 { grid-template-columns: minmax(0, 1fr); }
	.ag-meter { grid-template-columns: minmax(0, 1fr); }
	.ag-phase { padding-inline-start: 46px; }
	.ag-phase__mark { width: 30px; height: 30px; top: 22px; }
	.ag-phase::before { inset-inline-start: 14px; top: 56px; }
	.ag-phase__pct { display: none; }
	.ag-log li { grid-template-columns: minmax(0, 1fr); }
	.ag-avatar-card { flex-direction: column; align-items: flex-start; }
	.ag-modal__box { padding: 30px 22px 24px; border-radius: 20px; }
}
@media (prefers-reduced-motion: reduce) {
	.ag-profile *, .ag-modal * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
