/* ============================================================================
   InsuranceMonster - adminSite stylesheet
   Self-contained. Tokens mirror rootSite/css/site.css so admin stays on-brand.
   All visual styling lives here (no inline style attributes per project rules).
   ============================================================================ */

:root {
	--brand-700: #4a8a22;
	--brand-600: #5ea32e;
	--brand-500: #7cc242;
	--brand-300: #a6d977;
	--brand-100: #e2f2cf;
	--brand-50:  #f0f8e6;

	--ink:       #17233a;
	--bg-navy:   #14203a;

	--n-0:   #ffffff;
	--n-50:  #f5f8f3;
	--n-100: #eef2ea;
	--n-200: #e3e9dd;
	--n-300: #cfd8c8;

	--text:              #17233a;
	--text-muted:        #5c6a76;
	--text-invert:       #eef4ea;
	--text-invert-muted: #aebccb;
	--bg:                #ffffff;
	--bg-tint:           #f4f8f0;
	--border:            #e7ede1;
	--btn-ink:           #14261a;
	--danger-bg:  #fdecea; --danger-line: #f5c2bd; --danger-ink: #a12a1c;

	--r-sm: 10px; --r-md: 16px; --r-lg: 24px; --r-pill: 999px;
	--shadow-sm:  0 1px 2px rgba(20,40,20,.05), 0 3px 10px rgba(20,40,20,.05);
	--shadow-md:  0 12px 34px rgba(20,40,20,.09);
	--shadow-lg:  0 28px 64px rgba(20,40,20,.14);

	--s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;

	--font: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--font-brand: "Baloo 2", var(--font);
}

* { box-sizing: border-box; }

body {
	margin: 0;
	font-family: var(--font);
	color: var(--text);
	background: var(--bg);
	line-height: 1.6;
	font-size: 1rem;
	-webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0 0 .4em; color: var(--text); font-weight: 800; line-height: 1.15; }
h1 { font-size: 1.7rem; font-weight: 900; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p  { margin: 0 0 1rem; }
img { max-width: 100%; height: auto; display: block; }
a  { color: var(--brand-700); text-decoration: none; }

.im-muted { color: var(--text-muted); }

/* ---------- Buttons ---------- */
.im-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: .5em;
	font-family: var(--font); font-weight: 800; font-size: 1rem;
	padding: .72em 1.4em; border: 0; border-radius: var(--r-pill);
	background: var(--brand-500); color: var(--btn-ink); cursor: pointer;
	transition: transform .06s ease, box-shadow .15s ease, background .15s ease;
	box-shadow: 0 8px 20px rgba(124,194,66,.32);
}
.im-btn:hover { background: var(--brand-600); }
.im-btn:active { transform: translateY(1px); }
.im-btn:disabled { opacity: .6; cursor: default; box-shadow: none; }
.im-btn-block { width: 100%; }
.im-btn-sm { font-size: .88rem; padding: .5em 1em; }
.im-btn-ghost {
	background: transparent; color: var(--ink);
	box-shadow: none; border: 1.5px solid var(--border);
}
.im-btn-ghost:hover { background: var(--n-50); }

/* ---------- Forms ---------- */
.im-field { margin-bottom: var(--s4); }
.im-label { display: block; font-size: .88rem; font-weight: 700; margin-bottom: .35em; color: var(--ink); }
.im-input {
	width: 100%; font-family: var(--font); font-size: 1rem;
	padding: .7em .9em; border: 1.5px solid var(--border); border-radius: var(--r-sm);
	background: var(--n-50); color: var(--text); transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.im-input:focus {
	outline: none; border-color: var(--brand-500); background: var(--n-0);
	box-shadow: 0 0 0 3px rgba(124,194,66,.22);
}

/* ---------- Messages ---------- */
.im-msg { min-height: 1.2em; margin-bottom: var(--s3); font-size: .9rem; font-weight: 700; }
.im-msg-error {
	color: var(--danger-ink); background: var(--danger-bg); border: 1px solid var(--danger-line);
	padding: .55em .8em; border-radius: var(--r-sm);
}

/* ============================================================================
   LOGIN
   ============================================================================ */
body.im-auth { min-height: 100vh; }

.im-login-wrap { display: grid; grid-template-columns: 1.05fr .95fr; min-height: 100vh; }

.im-login-brand {
	background: var(--bg-navy); color: var(--text-invert);
	padding: clamp(40px, 6vw, 88px); display: flex; flex-direction: column; justify-content: center;
}
.im-login-logo { width: min(340px, 70%); margin-bottom: var(--s6); }
.im-login-tag { font-size: 1.12rem; color: var(--text-invert-muted); max-width: 40ch; margin-bottom: var(--s7); }
.im-login-features { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s4); }
.im-login-features li { display: flex; align-items: center; gap: var(--s3); font-weight: 700; color: var(--text-invert); }
.im-ico {
	flex: 0 0 auto; width: 40px; height: 40px; border-radius: var(--r-sm);
	background: rgba(124,194,66,.16); display: inline-flex; align-items: center; justify-content: center;
}
.im-ico svg { width: 20px; height: 20px; fill: none; stroke: var(--brand-500); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.im-ico svg .im-ico-line { stroke: var(--brand-300); }

.im-login-form {
	background: var(--bg-tint); display: flex; flex-direction: column; align-items: center; justify-content: center;
	padding: clamp(28px, 5vw, 72px);
}
.im-login-card {
	width: 100%; max-width: 400px; background: var(--n-0); border: 1px solid var(--border);
	border-radius: var(--r-lg); box-shadow: var(--shadow-md); padding: clamp(28px, 4vw, 40px);
}
.im-login-card-head { text-align: center; margin-bottom: var(--s6); }
.im-login-card-logo { width: 168px; margin: 0 auto var(--s4); }
.im-login-card-head h1 { font-size: 1.5rem; margin-bottom: .15em; }
.im-login-card-head p { font-size: .9rem; margin: 0; }
.im-login-foot { margin-top: var(--s5); font-size: .82rem; }

/* ============================================================================
   APP SHELL (top header + left sidebar + content)
   ============================================================================ */
body.im-app { background: var(--bg-tint); min-height: 100vh; display: flex; flex-direction: column; }

/* Top header (full width, white) */
.im-topbar {
	position: sticky; top: 0; z-index: 20;
	background: var(--n-0); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.im-topbar-inner {
	padding: var(--s3) var(--s5);
	display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
}
.im-topbar-logo { height: 70px; width: auto; }
.im-topbar-right { display: flex; align-items: center; gap: var(--s4); }
.im-user { font-weight: 800; color: var(--ink); font-size: .95rem; }
.im-user-role { font-weight: 700; font-size: .74rem; color: var(--brand-700); background: var(--brand-50); padding: .12em .6em; border-radius: var(--r-pill); margin-left: .3em; }
.im-env-badge { font-weight: 800; font-size: .72rem; letter-spacing: .04em; color: #fff; background: var(--brand-600); padding: .2em .6em; border-radius: var(--r-pill); }

/* Layout: sidebar + content */
.im-layout { flex: 1; display: flex; align-items: stretch; }

.im-sidebar {
	flex: 0 0 244px; width: 244px; background: var(--n-0);
	border-right: 1px solid var(--border); padding: var(--s5) var(--s3);
	position: sticky; top: 65px; align-self: flex-start; height: calc(100vh - 65px); overflow-y: auto;
}
.im-nav-section { margin-bottom: var(--s5); }
.im-nav-label {
	display: block; font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
	color: var(--text-muted); padding: 0 var(--s3); margin-bottom: var(--s2);
}
.im-nav-link {
	display: flex; align-items: center; gap: var(--s3);
	padding: .6em var(--s3); margin: 2px 0; border-radius: var(--r-sm);
	color: var(--ink); font-weight: 700; font-size: .95rem;
	transition: background .12s ease, color .12s ease;
}
.im-nav-link:hover { background: var(--n-50); }
.im-nav-link svg { flex: 0 0 auto; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.im-nav-link.is-active { background: var(--brand-50); color: var(--brand-700); }
.im-nav-link.is-active svg { opacity: 1; stroke: var(--brand-600); }

/* Content */
.im-content { flex: 1; min-width: 0; padding: var(--s7) var(--s6); }
.im-container { max-width: 1120px; }
.im-page-head { margin-bottom: var(--s6); }
.im-page-head h1 { margin-bottom: .1em; }

.im-stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s4); margin-bottom: var(--s6); }
.im-stat { background: var(--n-0); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s5); box-shadow: var(--shadow-sm); }
.im-stat-num { display: block; font-family: var(--font-brand); font-size: 2rem; font-weight: 800; color: var(--ink); line-height: 1; }
.im-stat-label { display: block; margin-top: .4em; font-size: .85rem; font-weight: 700; color: var(--text-muted); }
.im-stat-link { text-decoration: none; color: inherit; transition: box-shadow .12s, border-color .12s; }
.im-stat-link:hover { border-color: var(--brand-300); box-shadow: var(--shadow-md); }

.im-panel { background: var(--n-0); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s6); box-shadow: var(--shadow-sm); }
.im-panel h2 { margin-bottom: .3em; }
.im-panel p { margin: 0; }

/* ---------- Badges ---------- */
.im-badge { display: inline-block; font-size: .74rem; font-weight: 800; letter-spacing: .02em; color: var(--text-muted); background: var(--n-100); padding: .18em .6em; border-radius: var(--r-pill); }
.im-badge-ok  { color: var(--brand-700); background: var(--brand-50); }
.im-badge-bad { color: var(--danger-ink); background: var(--danger-bg); }

/* ---------- Tables ---------- */
.im-table-wrap { background: var(--n-0); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); overflow-x: auto; }
.im-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.im-table thead th {
	text-align: left; font-size: .72rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
	color: var(--text-muted); padding: .8em var(--s4); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.im-table tbody td { padding: .7em var(--s4); border-bottom: 1px solid var(--n-100); color: var(--text); vertical-align: middle; }
.im-table tbody tr:last-child td { border-bottom: 0; }
.im-table tbody tr:hover { background: var(--n-25, #fbfcfa); }

/* ---------- Notes / key-value / utilities ---------- */
.im-note { border-radius: var(--r-md); padding: var(--s4) var(--s5); margin-bottom: var(--s5); font-size: .92rem; }
.im-note-warn { background: #fff4e0; border: 1px solid #f2d9a8; color: #8a5300; }
.im-note strong { font-weight: 800; }

.im-kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s3); margin: 0; }
.im-kv > div { display: flex; justify-content: space-between; gap: var(--s3); padding: .5em 0; border-bottom: 1px solid var(--n-100); }
.im-kv dt { color: var(--text-muted); font-weight: 700; font-size: .88rem; margin: 0; }
.im-kv dd { margin: 0; font-weight: 700; text-align: right; word-break: break-word; }

.im-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86rem; }
.im-actions { display: flex; flex-wrap: wrap; gap: var(--s3); }
.im-mb { margin-bottom: var(--s5); }
.im-mt { margin-top: var(--s4); }
.im-msg-ok { color: var(--brand-700); background: var(--brand-50); border: 1px solid var(--brand-100); padding: .55em .8em; border-radius: var(--r-sm); }

/* ---------- Site map reader ---------- */
.im-sm-site { margin-bottom: var(--s7); }
.im-sm-site-head { display: flex; align-items: baseline; gap: var(--s3); margin-bottom: var(--s4); }
.im-sm-site-head h2 { margin: 0; }
.im-sm-key { font-size: .78rem; }
.im-sm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s4); }
.im-sm-card { background: var(--n-0); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); padding: var(--s4) var(--s5); }
.im-sm-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s2); padding-bottom: var(--s2); border-bottom: 1px solid var(--n-100); }
.im-sm-card-head h3 { margin: 0; font-size: .98rem; }
.im-sm-count { flex: 0 0 auto; font-size: .74rem; font-weight: 800; color: var(--brand-700); background: var(--brand-50); padding: .1em .55em; border-radius: var(--r-pill); }
.im-sm-list { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; }
.im-sm-list li { margin: 0; }
.im-sm-list a { display: block; padding: .32em 0; font-size: .86rem; color: var(--ink); border-bottom: 1px solid transparent; word-break: break-word; }
.im-sm-list a:hover { color: var(--brand-700); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
	.im-login-wrap { grid-template-columns: 1fr; }
	.im-login-brand { display: none; }
	.im-layout { flex-direction: column; }
	.im-sidebar {
		flex-basis: auto; width: 100%; height: auto; position: static;
		border-right: 0; border-bottom: 1px solid var(--border);
		display: flex; flex-wrap: wrap; gap: var(--s2); padding: var(--s3) var(--s4);
	}
	.im-nav-section { margin-bottom: 0; display: flex; flex-wrap: wrap; gap: var(--s2); }
	.im-nav-label { display: none; }
	.im-content { padding: var(--s5) var(--s4); }
	.im-stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
	.im-stat-grid { grid-template-columns: 1fr; }
	.im-topbar-right { gap: var(--s2); }
	.im-user { display: none; }
}
