/*
 * CityGroup CRM: the one stylesheet.
 *
 *  1. Themes (light, dark)    6. Sections and tiles   11. Toasts
 *  2. Base                    7. Toolbar and filters  12. Dialogs, sheet, popover
 *  3. Links                   8. Tables and lists     13. App layout
 *  4. Buttons                 9. Badges, chips        14. Sign-in page
 *  5. Forms                  10. Empty states
 *
 * Look: calm and plain. Content sits on the page, rows highlight on hover, one font (Inter).
 * Light and dark follow the device, or the choice in the account menu (html[data-theme]).
 * Brand: the OneProp logo, black on light and white on dark.
 */

/* 1. Themes
   ========================================================================== */

:root {
	color-scheme: light;

	--bg: #ffffff;             /* page */
	--tile: #f4f4f6;           /* tiles, fields, secondary buttons, row hover */
	--tile-hover: #ebebef;
	--line: #ececf0;
	--text: #0f0f12;
	--text-2: #5d5d66;         /* secondary text: 6:1 on white */
	--text-3: #8c8c95;         /* hints and placeholders only */
	--ink: #0f0f12;            /* primary button and current item */
	--on-ink: #ffffff;
	--overlay: rgb(15 15 18 / 40%);
	--popover: #ffffff;
	--shadow-pop: 0 10px 40px rgb(0 0 0 / 14%), 0 0 0 1px rgb(0 0 0 / 5%);
	--glass: rgb(255 255 255 / 82%);


	--focus: #2f6fed;

	--positive: #16803c;
	--positive-bg: #e8f5ec;
	--warning: #9a5b00;
	--warning-bg: #fff3e0;
	--negative: #c81e2e;
	--negative-bg: #fdecee;
	--neutral: #5d5d66;
	--neutral-bg: #f0f0f3;
	--info: #1e5bd6;
	--info-bg: #ebf1fe;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		color-scheme: dark;
		--bg: #0c0d11;
		--tile: #17181e;
		--tile-hover: #202128;
		--line: #1f2027;
		--text: #f2f2f5;
		--text-2: #a3a4ae;
		--text-3: #6f707a;
		--ink: #f2f2f5;
		--on-ink: #0c0d11;
		--overlay: rgb(0 0 0 / 60%);
		--popover: #1b1c22;
		--shadow-pop: 0 10px 40px rgb(0 0 0 / 50%), 0 0 0 1px rgb(255 255 255 / 6%);
		--glass: rgb(12 13 17 / 82%);
		--focus: #6b9bff;
		--positive: #3ccb6f;
		--positive-bg: rgb(60 203 111 / 12%);
		--warning: #f0a83a;
		--warning-bg: rgb(240 168 58 / 12%);
		--negative: #ff6b6b;
		--negative-bg: rgb(255 107 107 / 12%);
		--neutral: #a3a4ae;
		--neutral-bg: rgb(255 255 255 / 7%);
		--info: #7aa7ff;
		--info-bg: rgb(122 167 255 / 12%);
	}
}

:root[data-theme="dark"] {
	color-scheme: dark;
	--bg: #0c0d11;
	--tile: #17181e;
	--tile-hover: #202128;
	--line: #1f2027;
	--text: #f2f2f5;
	--text-2: #a3a4ae;
	--text-3: #6f707a;
	--ink: #f2f2f5;
	--on-ink: #0c0d11;
	--overlay: rgb(0 0 0 / 60%);
	--popover: #1b1c22;
	--shadow-pop: 0 10px 40px rgb(0 0 0 / 50%), 0 0 0 1px rgb(255 255 255 / 6%);
	--glass: rgb(12 13 17 / 82%);
	--focus: #6b9bff;
	--positive: #3ccb6f;
	--positive-bg: rgb(60 203 111 / 12%);
	--warning: #f0a83a;
	--warning-bg: rgb(240 168 58 / 12%);
	--negative: #ff6b6b;
	--negative-bg: rgb(255 107 107 / 12%);
	--neutral: #a3a4ae;
	--neutral-bg: rgb(255 255 255 / 7%);
	--info: #7aa7ff;
	--info-bg: rgb(122 167 255 / 12%);
}

:root {
	--font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
	--fs: 14px;
	--fs-sm: 13px;
	--fs-xs: 12px;
	--fs-input: 14px;

	--r-sm: 8px;
	--r: 12px;
	--r-lg: 16px;
	--pill: 999px;

	--control-h: 36px;
	--field-h: 40px;
	--sidebar-w: 232px;
	--topbar-h: 60px;
	--bottombar-h: 60px;
	--content-max: 1040px;
	--gutter: 16px;
}

@media (min-width: 768px) { :root { --gutter: 32px; } }

/* Bigger targets and 16px fields (no zoom on iOS) on touch screens */
@media (pointer: coarse) {
	:root { --control-h: 44px; --field-h: 46px; --fs-input: 16px; }
}

/* 2. Base
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	font-family: var(--font);
	font-size: var(--fs);
	line-height: 1.5;
	font-feature-settings: "cv11", "ss01";
	color: var(--text);
	background: var(--bg);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 { margin: 0; color: var(--text); font-weight: 600; letter-spacing: -0.011em; line-height: 1.3; }
h1 { font-size: 20px; }
h2 { font-size: 15px; }
p { margin: 0; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

[id] { scroll-margin-top: calc(var(--topbar-h) + 16px); }

.icon { width: 20px; height: 20px; flex: none; }
.icon--sm { width: 16px; height: 16px; }
.ic { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.muted { color: var(--text-2); }
.sm { font-size: var(--fs-sm); }
.num { font-variant-numeric: tabular-nums; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.stack--lg { gap: 40px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* Shown on phones only (e.g. the status under a price when the Status column is hidden) */
@media (min-width: 768px) { .only-phone { display: none !important; } }

.visually-hidden {
	position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
	position: absolute; left: 8px; top: -100px; z-index: 100;
	padding: 8px 16px; border-radius: var(--pill);
	background: var(--ink); color: var(--on-ink);
}
.skip-link:focus { top: 8px; }

/* 3. Links
   A link keeps its colour; hover adds an underline. Menu items and buttons set their own look.
   ========================================================================== */

a { color: inherit; text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
.link { color: var(--text); text-decoration: underline; text-decoration-color: var(--text-3); }
.link:hover { text-decoration-color: currentColor; }
.btn:hover, .nav__item:hover, .menu__item:hover, .tab:hover, .brand:hover, .chip:hover { text-decoration: none; }

/* 4. Buttons
   ========================================================================== */

.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	height: var(--control-h); padding: 0 14px;
	border: 0; border-radius: var(--pill);
	font: inherit; font-size: var(--fs); font-weight: 600; line-height: 1;
	white-space: nowrap; cursor: pointer;
	background: var(--tile); color: var(--text);
	transition: background-color 0.12s, opacity 0.12s;
}
.btn:hover { background: var(--tile-hover); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.btn--primary { background: var(--ink); color: var(--on-ink); }
.btn--primary:hover { background: var(--ink); opacity: 0.86; }
.btn--ghost { background: transparent; }
.btn--ghost:hover { background: var(--tile); }
.btn--danger { background: var(--negative-bg); color: var(--negative); }
.btn--danger:hover { background: var(--negative-bg); opacity: 0.8; }
.btn--icon { width: var(--control-h); padding: 0; }
.btn--block { width: 100%; }
.btn--lg { height: 46px; padding: 0 20px; font-size: 15px; }

/* 5. Forms
   ========================================================================== */

.form { display: grid; gap: 20px; max-width: 640px; }
.form__row { display: grid; gap: 20px; }
@media (min-width: 640px) { .form__row { grid-template-columns: 1fr 1fr; gap: 16px; } }

.field { display: grid; gap: 6px; }
.field > label, .field > legend { font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); }
.field__help { font-size: var(--fs-xs); color: var(--text-2); }
.field__error { font-size: var(--fs-xs); font-weight: 500; color: var(--negative); }

.input,
.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field input[type="tel"], .field input[type="number"], .field input[type="date"],
.field input[type="search"], .field input[type="url"], .field select, .field textarea {
	width: 100%; height: var(--field-h); padding: 0 12px;
	border: 0; border-radius: var(--r);
	background: var(--tile); color: var(--text);
	font: inherit; font-size: var(--fs-input);
	box-shadow: inset 0 0 0 1px transparent;
	transition: background-color 0.12s, box-shadow 0.12s;
	appearance: none;
}
.field textarea { height: auto; min-height: 112px; padding: 10px 12px; resize: vertical; }
select.input, .field select {
	padding-right: 34px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%238c8c95' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
	background-repeat: no-repeat; background-position: right 10px center;
}
.input::placeholder, .field input::placeholder, .field textarea::placeholder { color: var(--text-3); }
.input:hover, .field input:hover, .field select:hover, .field textarea:hover { background-color: var(--tile-hover); }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; background-color: var(--bg); box-shadow: inset 0 0 0 1.5px var(--text); }
.field--error input, .field--error select, .field--error textarea { box-shadow: inset 0 0 0 1.5px var(--negative); }
.input--auto { width: auto; }

.search { position: relative; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search input { padding-left: 36px; border-radius: var(--pill); }

.field__password { position: relative; }
.field__password input { padding-right: 72px; }
.field__password .btn { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); height: 32px; font-size: var(--fs-sm); }

.check { display: flex; align-items: center; gap: 10px; min-height: var(--control-h); }
.check input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--ink); }
fieldset.field { margin: 0; padding: 0; border: 0; }

.alert { padding: 10px 14px; border-radius: var(--r); font-size: var(--fs-sm); font-weight: 500; }
.alert--error { background: var(--negative-bg); color: var(--negative); }
.alert--info { background: var(--info-bg); color: var(--info); }

/* 6. Sections and tiles
   A section is a titled block on the page. Tiles are soft grey boxes for figures.
   ========================================================================== */

.section__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; min-height: var(--control-h); }
.section__sub { font-size: var(--fs-sm); color: var(--text-2); }

.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 768px) { .tiles { gap: 12px; } }
.tile { padding: 14px; border-radius: var(--r-lg); background: var(--tile); }
@media (min-width: 768px) { .tile { padding: 18px 20px; } }
.tile__value { display: block; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile__label { display: block; margin-top: 4px; font-size: var(--fs-xs); color: var(--text-2); }
@media (min-width: 768px) { .tile__value { font-size: 28px; } .tile__label { font-size: var(--fs-sm); } }

.box { padding: 16px; border-radius: var(--r-lg); background: var(--tile); }
@media (min-width: 768px) { .box { padding: 24px; } }

/* 7. Toolbar and filters
   ========================================================================== */

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.toolbar .search { flex: 1 1 200px; max-width: 280px; }
.toolbar [data-list-clear] { display: none; }
.toolbar.has-filters [data-list-clear] { display: inline-flex; }
/* On desktop the column headers sort the list; the sort menu is for phones, where headers are hidden. */
@media (min-width: 768px) { .toolbar [data-list-sort] { display: none; } }
.toolbar .input { height: var(--control-h); border-radius: var(--pill); width: auto; font-size: var(--fs); }
@media (max-width: 639px) {
	.toolbar .search { max-width: none; flex-basis: 100%; }
	.toolbar .input { flex: 1; }
}

/* 8. Tables and lists
   Plain rows that highlight on hover. On phones, a table becomes a list of rows:
   the cells marked .cell-main and .cell-end stay; the others hide unless marked .cell-keep.
   ========================================================================== */

.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th {
	padding: 0 12px 8px; text-align: left; white-space: nowrap;
	font-size: var(--fs-xs); font-weight: 500; color: var(--text-2);
}
.table td { padding: 10px 12px; vertical-align: middle; white-space: nowrap; }
.table td.cell-main-td { white-space: normal; width: 100%; }
.table tbody tr:hover td { background: var(--tile); }
.table tbody tr td:first-child { border-radius: var(--r) 0 0 var(--r); }
.table tbody tr td:last-child { border-radius: 0 var(--r) var(--r) 0; }
.table .end { text-align: right; }
.table th button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 2px; }
.table th button:hover { color: var(--text); }
.table th button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.table .actions { width: 1%; white-space: nowrap; text-align: right; }
.table .actions .btn { opacity: 0.6; }
.table tr:hover .actions .btn, .table .actions .btn:focus-visible { opacity: 1; }

.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-main__text { min-width: 0; }
.title { display: block; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { display: block; font-size: var(--fs-xs); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.avatar {
	display: grid; place-items: center; flex: none;
	width: 36px; height: 36px; border-radius: 50%;
	background: var(--tile-hover); color: var(--text-2);
	font-size: var(--fs-xs); font-weight: 600;
	overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--square { border-radius: var(--r-sm); }

@media (max-width: 767px) {
	.table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
	.table, .table tbody { display: block; }
	.table tr { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: var(--r); }
	.table tbody tr:hover { background: var(--tile); }
	.table tbody tr:hover td { background: none; }
	.table td { display: none; padding: 0; }
	.table td.cell-keep, .table td.cell-main-td, .table td.cell-end-td { display: block; }
	.table td.cell-keep { flex: 1; }
	.table td.cell-main-td { flex: 1; min-width: 0; }
	.table td.cell-end-td { text-align: right; }
	.table .actions { display: none; }
}

.list { margin: 0; padding: 0; list-style: none; }
.list > li { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }

/* Scrolling lists (apps/core/lists.py): sticky header, loading row, end of list */
.table--list thead th { position: sticky; top: var(--topbar-h); z-index: 2; padding-top: 8px; background: var(--glass); backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px); box-shadow: inset 0 -1px 0 var(--line); }
.table--list th[aria-sort="ascending"] button, .table--list th[aria-sort="descending"] button { color: var(--text); }
[data-list] { transition: opacity 0.15s; }
[data-list].is-refreshing { opacity: 0.5; pointer-events: none; }
.list-more td, .list-end td { padding: 16px 0; text-align: center; white-space: normal; }
.list-end td { color: var(--text-2); font-size: var(--fs-sm); }
.table tbody tr.list-more:hover td, .table tbody tr.list-end:hover td { background: none; }
.js .list-more .btn { display: none; }
.js .list-more.is-error .btn { display: inline-flex; }
.skeleton { display: none; gap: 8px; }
.list-more.is-loading .skeleton { display: grid; }
.skeleton i { display: block; height: 44px; border-radius: var(--r); background: linear-gradient(90deg, var(--tile) 0%, var(--tile-hover) 50%, var(--tile) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton i { animation: none; } }
.js [data-no-js-only] { display: none; }

/* 9. Badges and chips
   ========================================================================== */

.status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; color: var(--neutral); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status--available { color: var(--positive); }
.status--reserved { color: var(--warning); }
.status--sold { color: var(--negative); }
.status--unreleased { color: var(--neutral); }

.badge { display: inline-block; padding: 2px 8px; border-radius: var(--pill); font-size: var(--fs-xs); font-weight: 600; background: var(--neutral-bg); color: var(--neutral); }

/* Reference numbers: PREFIX-YYMM-SEQ */
.ref { font-size: var(--fs-xs); font-weight: 500; color: var(--text-2); font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }

.chip {
	display: inline-flex; align-items: center; gap: 6px;
	height: 32px; padding: 0 12px; border-radius: var(--pill);
	background: var(--tile); color: var(--text); font-size: var(--fs-sm); font-weight: 500;
}

/* 10. Empty states
   ========================================================================== */

.empty { display: grid; justify-items: center; gap: 6px; padding: 48px 16px; text-align: center; color: var(--text-2); }
.empty > .icon { width: 44px; height: 44px; padding: 11px; margin-bottom: 6px; border-radius: 50%; background: var(--tile); color: var(--text); }
.box.empty > .icon { background: var(--bg); }
.empty__title { font-size: 15px; font-weight: 600; color: var(--text); }
.empty .btn { margin-top: 10px; }

/* 11. Toasts
   ========================================================================== */

.toasts {
	position: fixed; z-index: 60; left: var(--gutter); right: var(--gutter);
	bottom: calc(var(--bottombar-h) + 12px + env(safe-area-inset-bottom));
	display: grid; gap: 8px; justify-items: center; pointer-events: none;
}
.toast {
	display: flex; align-items: center; gap: 8px; width: 100%; max-width: 420px;
	padding: 6px 6px 6px 16px; border-radius: var(--pill);
	background: var(--ink); color: var(--on-ink);
	font-size: var(--fs); font-weight: 500;
	box-shadow: var(--shadow-pop); pointer-events: auto;
	transition: opacity 0.25s, transform 0.25s;
}
.toast__text { flex: 1; }
.toast .btn { width: 32px; height: 32px; background: transparent; color: inherit; }
.toast .btn:hover { background: rgb(128 128 128 / 20%); }
.toast--success .toast__text::before, .toast--error .toast__text::before { content: "● "; }
.toast--success .toast__text::before { color: #34c759; }
.toast--error .toast__text::before { color: #ff453a; }
.toast--hide { opacity: 0; transform: translateY(6px); }
@media (min-width: 1024px) { .toasts { left: auto; right: 24px; bottom: 24px; width: 380px; justify-items: end; } }
.page-auth .toasts { bottom: auto; top: 16px; }

/* 12. Dialogs, bottom sheet, popover
   ========================================================================== */

.dialog {
	width: min(100% - 2 * var(--gutter), 420px); padding: 0; border: 0; border-radius: 20px;
	background: var(--popover); color: var(--text); box-shadow: var(--shadow-pop);
}
.dialog::backdrop, .sheet::backdrop { background: var(--overlay); }
.dialog__body { display: grid; gap: 8px; padding: 24px; }
.dialog__actions { display: flex; flex-wrap: wrap-reverse; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.sheet {
	width: 100%; max-width: 100%; max-height: 88dvh; margin: auto 0 0; padding: 0; border: 0;
	border-radius: 20px 20px 0 0; background: var(--popover); color: var(--text);
	padding-bottom: calc(12px + env(safe-area-inset-bottom));
}
.sheet::before { content: ""; display: block; width: 36px; height: 5px; margin: 8px auto 4px; border-radius: var(--pill); background: var(--tile-hover); }

.popover {
	position: fixed; inset: auto; top: 52px; right: 16px; width: 300px; margin: 0; padding: 8px;
	border: 0; border-radius: 20px; background: var(--popover); color: var(--text); box-shadow: var(--shadow-pop);
}

/* Menu items: account menu and "More" sheet */
.menu { margin: 0; padding: 0 8px; list-style: none; display: grid; gap: 2px; }
.menu__item {
	display: flex; align-items: center; gap: 12px; width: 100%;
	min-height: 40px; padding: 0 10px; border: 0; border-radius: var(--r);
	background: none; color: var(--text); font: inherit; font-weight: 500; text-align: left; cursor: pointer;
}
.menu__item .icon { color: var(--text-2); }
a.menu__item:hover, button.menu__item:hover { background: var(--tile); }
.menu__item[aria-current="page"] { background: var(--tile); font-weight: 600; }
.menu__item[aria-current="page"] .icon { color: var(--text); }
.menu__item--soon { color: var(--text-3); cursor: default; }
.menu__item--soon .icon { color: var(--text-3); }
.menu__label { flex: 1; }
.menu__note { font-size: var(--fs-xs); color: var(--text-3); }
.menu__sep { height: 1px; margin: 8px 16px; background: var(--line); }
@media (pointer: coarse) { .menu__item { min-height: 46px; } }

.profile { display: grid; justify-items: center; gap: 2px; padding: 16px 12px 12px; text-align: center; }
.profile .user-avatar { width: 56px; height: 56px; font-size: 18px; margin-bottom: 8px; }
.profile__name { font-size: 16px; font-weight: 600; }
.profile__email { font-size: var(--fs-sm); color: var(--text-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* Light / Dark / Auto switch */
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin: 4px 8px 8px; padding: 3px; border-radius: var(--pill); background: var(--tile); }
.segmented button {
	height: 30px; border: 0; border-radius: var(--pill); background: none; color: var(--text-2);
	font: inherit; font-size: var(--fs-sm); font-weight: 500; cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--popover); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 12%); }
.menu__meta { padding: 8px 16px 6px; font-size: var(--fs-xs); color: var(--text-3); text-align: center; }

.user-avatar {
	display: grid; place-items: center; flex: none;
	width: 32px; height: 32px; border-radius: 50%;
	background: var(--tile-hover); color: var(--text);
	font-size: var(--fs-xs); font-weight: 600;
}

/* 13. App layout
   Desktop (1024px+): sidebar + top bar. Phones: top bar + bottom tab bar + "More" sheet.
   ========================================================================== */

.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); white-space: nowrap; }
/* OneProp logo: the black version on light, the white version on dark */
.logo { display: block; height: 22px; width: auto; }
.brand--lg .logo { height: 28px; }
.logo--on-dark { display: none; }
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .logo--on-light { display: none; }
	:root:not([data-theme="light"]) .logo--on-dark { display: block; }
}
:root[data-theme="dark"] .logo--on-light { display: none; }
:root[data-theme="dark"] .logo--on-dark { display: block; }

.sidebar { display: none; }

.topbar {
	position: sticky; top: 0; z-index: 30;
	display: flex; align-items: center; gap: 12px;
	height: var(--topbar-h); padding: 0 var(--gutter);
	background: var(--glass); backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
}
.topbar__title { flex: 1; min-width: 0; font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__account { padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer; }
.topbar__account:hover .user-avatar { background: var(--tile); box-shadow: 0 0 0 2px var(--line); }

.content {
	width: 100%; max-width: var(--content-max); margin: 0 auto;
	padding: 8px var(--gutter) calc(var(--bottombar-h) + 40px + env(safe-area-inset-bottom));
}

.page-intro { margin-bottom: 24px; }
.page-intro__sub { color: var(--text-2); }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 4px; padding: 0; list-style: none; font-size: var(--fs-sm); color: var(--text-2); }
.breadcrumb li + li::before { content: "/"; margin-right: 6px; color: var(--text-3); }

.bottombar {
	position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
	display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
	height: calc(var(--bottombar-h) + env(safe-area-inset-bottom));
	padding-bottom: env(safe-area-inset-bottom);
	background: var(--glass); backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
	border-top: 1px solid var(--line);
}
.tab {
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
	min-width: 0; padding: 0; border: 0; background: none;
	font: inherit; font-size: 11px; font-weight: 500; color: var(--text-3); cursor: pointer;
}
.tab .icon { width: 22px; height: 22px; }
a.tab:hover, button.tab:hover { color: var(--text); }
.tab[aria-current="page"] { color: var(--text); }
.tab[aria-current="page"] .icon { stroke-width: 2.2; }
.tab[aria-disabled="true"] { opacity: 0.5; cursor: default; }

/* Navigation items in the sidebar */
.nav { margin: 0; padding: 0 12px; list-style: none; display: grid; gap: 2px; }
.nav__item {
	display: flex; align-items: center; gap: 12px;
	height: 38px; padding: 0 10px; border-radius: var(--r);
	color: var(--text-2); font-weight: 500;
}
a.nav__item:hover { background: var(--tile); color: var(--text); }
.nav__item[aria-current="page"] { background: var(--tile); color: var(--text); font-weight: 600; }
.nav__item--soon { color: var(--text-3); cursor: default; }
.nav__item .menu__note { margin-left: auto; }

@media (min-width: 1024px) {
	.layout { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
	.sidebar {
		position: sticky; top: 0; height: 100vh;
		display: flex; flex-direction: column; gap: 16px;
		padding: 16px 0 12px;
		border-right: 1px solid var(--line);
		background: var(--bg);
	}
	.sidebar .brand { padding: 6px 22px 14px; }
	.sidebar .logo { height: 32px; }
	.sidebar nav { flex: 1; overflow-y: auto; }
	.sidebar__foot { padding: 0 12px; }
	.topbar { padding: 0 32px; }
	.content { padding: 8px 32px 64px; }
	.bottombar { display: none; }
	.popover { top: 54px; right: 24px; }
}

/* 14. Sign-in page
   ========================================================================== */

.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; align-content: center; gap: 28px; padding: 24px var(--gutter); }
.auth__card { width: 100%; max-width: 380px; display: grid; gap: 20px; }
.auth__title { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.auth__sub { margin-top: 4px; color: var(--text-2); }
.auth .field input { height: 46px; }

/* History (audit log) of a record: templates/includes/history.html */
.history { margin: 0; padding: 0; list-style: none; }
.history__item { position: relative; padding: 10px 0 10px 20px; border-left: 2px solid var(--line); }
.history__item::before { content: ""; position: absolute; left: -5px; top: 16px; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.history__item--error::before { background: var(--negative); }
.history__item--error .history__action { color: var(--negative); }
.history__head { display: flex; flex-wrap: wrap; gap: 4px; font-weight: 500; }
.history__action { font-weight: 600; }
.history__changes { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 2px; font-size: var(--fs-sm); overflow-wrap: anywhere; }

/* People: avatars with photos, person header, company checklist, file input (step 0.12) */
.user-avatar { overflow: hidden; }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.user-avatar--lg { width: 56px; height: 56px; font-size: 18px; }
.profile .user-avatar { margin-bottom: 8px; }
.cell-main .user-avatar { width: 36px; height: 36px; }
.person-head { display: flex; align-items: center; gap: 16px; }
.checklist { display: grid; gap: 0 16px; }
@media (min-width: 640px) { .checklist { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.file-input { font: inherit; font-size: var(--fs-sm); color: var(--text-2); }
.file-input::file-selector-button { margin-right: 12px; height: var(--control-h); padding: 0 14px; border: 0; border-radius: var(--pill); background: var(--tile); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.auth .link { justify-self: center; font-size: var(--fs-sm); }
