/* Righvedh Sanjivni CRM - stylesheet
   Palette: primary #C45A3C | dark #783827 | sidebar #211A17 | background #FAF7F3 | card #FFFFFF | text #29231F | accent #D99A5B */
:root {
  --primary: #C45A3C; --primary-dark: #783827; --sidebar: #211A17; --bg: #FAF7F3; --card: #FFFFFF; --text: #29231F; --accent: #D99A5B;
  --muted: #86786D; --line: #EDE4DB; --line-strong: #DDD0C4;
  --primary-soft: #F8E8E2; --accent-soft: #FBEFDF;
  --success: #2E7D4F; --success-soft: #E3F1E8; --danger: #B03A2E; --danger-soft: #F8E2DF;
  --warning: #A86A12; --warning-soft: #FBEED6; --info: #35688A; --info-soft: #E2EDF4;
  --radius: 12px; --radius-sm: 8px; --shadow: 0 1px 2px rgba(41,35,31,.05), 0 6px 18px rgba(41,35,31,.05);
  --sidebar-w: 264px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 14px; line-height: 1.6; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.3; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.ic { flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.mt { margin-top: 14px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* ------------------------------------------------------------ layout */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--sidebar); color: #D9CFC6; display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 40; }
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 20px; color: #fff; }
.brand:hover { color: #fff; }
.brand-mark { width: 40px; height: 40px; border-radius: 11px; background: linear-gradient(145deg, var(--primary), var(--primary-dark)); display: grid; place-items: center; color: #fff; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { font-size: 15px; font-weight: 600; letter-spacing: .1px; }
.brand-text small { font-size: 11px; color: #A29489; font-weight: 400; }
.nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 9px; color: #C9BDB2; font-weight: 400; position: relative; transition: background .15s, color .15s; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active { background: rgba(196,90,60,.2); color: #fff; font-weight: 500; }
.nav-link.active::before { content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-link.active .ic { color: var(--accent); }
.side-user { display: flex; align-items: center; gap: 8px; padding: 14px 14px; border-top: 1px solid rgba(255,255,255,.08); }
.side-user-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: #fff; }
.side-user-link:hover { color: #fff; }
.side-user-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.side-user-text strong { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-text small { font-size: 11px; color: #A29489; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--sidebar); display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 14px 32px; background: rgba(250,247,243,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.global-search { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line-strong); border-radius: 10px; padding: 0 14px; color: var(--muted); }
.global-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.global-search input { border: 0; outline: 0; background: transparent; padding: 10px 0; width: 100%; font-size: 13px; }
.global-search-spacer { flex: 1; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.content { padding: 28px 32px 48px; max-width: 1480px; width: 100%; }
.menu-btn { display: none; }
.scrim { display: none; }

.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: transparent; display: inline-grid; place-items: center; cursor: pointer; color: var(--text); position: relative; }
.icon-btn:hover { background: var(--primary-soft); color: var(--primary-dark); }
.icon-btn.dark { color: #C9BDB2; } .icon-btn.dark:hover { background: rgba(255,255,255,.08); color: #fff; }
.bell-wrap { position: relative; }
.bell-count { position: absolute; top: 3px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--primary); color: #fff; font-size: 10.5px; font-weight: 600; display: grid; place-items: center; border: 2px solid var(--bg); }
.bell-panel { position: absolute; right: 0; top: 46px; width: 360px; max-width: calc(100vw - 24px); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 14px 40px rgba(41,35,31,.18); overflow: hidden; z-index: 50; }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.bell-list { max-height: 380px; overflow-y: auto; }
.bell-item { display: block; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--text); position: relative; }
.bell-item:hover { background: var(--bg); color: var(--text); }
.bell-item.unread { background: #FFFBF7; padding-left: 26px; }
.bell-item.unread::before { content: ''; position: absolute; left: 12px; top: 20px; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.bell-item strong { display: block; font-size: 13px; font-weight: 500; }
.bell-item span { display: block; font-size: 12px; color: var(--muted); }
.bell-item small { font-size: 11px; color: #A99C91; }
.bell-empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.bell-foot { display: block; text-align: center; padding: 12px; font-weight: 500; border-top: 1px solid var(--line); }
.link-btn { background: none; border: 0; color: var(--primary); cursor: pointer; padding: 0; font-size: 12.5px; }

/* ------------------------------------------------------------ page head */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; letter-spacing: -.2px; }
.page-head p { color: var(--muted); margin-top: 2px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); margin-bottom: 12px; font-size: 13px; }
.back-link:hover { color: var(--primary); }

/* ------------------------------------------------------------ cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 0; }
.card-head h2, .card-head h3 { font-size: 15.5px; }
.card-body { padding: 18px 22px 22px; }
.card + .card, .grid + .card, .card + .grid { margin-top: 20px; }
.grid { display: grid; gap: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.cols-2 { grid-template-columns: 2fr 1fr; align-items: start; }
.cols-2e { grid-template-columns: 1fr 1fr; align-items: start; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px; color: var(--text); }
a.stat:hover { border-color: var(--accent); color: var(--text); }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; flex: none; }
.stat-icon.accent { background: var(--accent-soft); color: #A9662A; }
.stat-icon.dark { background: #EFE7DF; color: var(--primary-dark); }
.stat-num { font-size: 26px; font-weight: 600; line-height: 1.1; letter-spacing: -.4px; }
.stat-label { color: var(--muted); font-size: 12.5px; margin-top: 3px; }

/* ------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); background: #FDFBF9; white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FEFCFA; }
.table .num, .doc-table .num { text-align: right; }
.table .actions { text-align: right; white-space: nowrap; }
.cell-main { font-weight: 500; }
.cell-sub { font-size: 12px; color: var(--muted); }
.card > .table-wrap:first-child .table th:first-child { border-top-left-radius: var(--radius); }
.card > .table-wrap:first-child { border-radius: var(--radius); }
.row-link { color: var(--text); font-weight: 500; } .row-link:hover { color: var(--primary); }

/* ------------------------------------------------------------ badges */
.badge { display: inline-block; padding: 3px 11px; border-radius: 20px; font-size: 12px; font-weight: 500; white-space: nowrap; line-height: 1.5; }
.badge-primary { background: var(--primary-soft); color: var(--primary-dark); }
.badge-accent { background: var(--accent-soft); color: #8F5520; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: #EFEAE5; color: #6F625A; }

/* ------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 9px; border: 1px solid transparent; font-weight: 500; font-size: 13.5px; cursor: pointer; transition: background .15s, border-color .15s, color .15s; line-height: 1.3; text-decoration: none; white-space: nowrap; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-outline { background: var(--card); border-color: var(--line-strong); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: #F1EBE5; color: var(--text); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success { background: var(--success-soft); color: var(--success); }
.btn-success:hover { background: var(--success); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; gap: 6px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------ forms */
.field { margin-bottom: 16px; }
.field label, .label { display: block; font-weight: 500; font-size: 13px; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=datetime-local], input[type=tel], input[type=search], input[type=url], select, textarea {
  width: 100%; padding: 10px 13px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; font-size: 14px; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input[type=file] { width: 100%; padding: 9px; border: 1px dashed var(--line-strong); border-radius: 9px; background: #FDFBF9; font-size: 13px; }
textarea { resize: vertical; min-height: 80px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2386786D' stroke-width='2.2' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.hint { display: block; font-size: 12px; color: var(--muted); margin-top: 5px; }
.check { display: flex; align-items: center; gap: 9px; margin: 6px 0 14px; cursor: pointer; font-size: 13.5px; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 6px; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; padding: 16px 20px; }
.filters .field { margin: 0; min-width: 150px; flex: 1; max-width: 220px; }
.filters .field.grow { flex: 2; max-width: 300px; }
.filters label { font-size: 12px; color: var(--muted); }
.filters input, .filters select { padding: 8px 12px; font-size: 13px; }
.input-icon { position: relative; } .input-icon .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); } .input-icon input { padding-left: 38px; }

/* ------------------------------------------------------------ alerts / toast */
.alert { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 10px; margin-bottom: 18px; font-weight: 500; border: 1px solid; }
.alert span { flex: 1; }
.alert-success { background: var(--success-soft); color: var(--success); border-color: #C8E3D2; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: #EDC5C0; }
.alert-close { background: none; border: 0; cursor: pointer; color: inherit; opacity: .6; display: grid; }
.toast-stack { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { background: var(--sidebar); color: #fff; padding: 12px 18px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.25); display: flex; align-items: center; gap: 10px; animation: toast-in .2s ease-out; max-width: 360px; }
.toast.error { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------ modal */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(33,26,23,.55); }
.modal-box { position: relative; background: var(--card); border-radius: 14px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0,0,0,.3); animation: modal-in .18s ease-out; }
.modal-box.modal-lg { max-width: 720px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px 22px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.progress { height: 8px; background: #EFE7DF; border-radius: 6px; overflow: hidden; margin: 6px 0 14px; }
.progress span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .15s; }
.geo-box { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 12px 14px; background: var(--bg); border: 1px dashed var(--line-strong); border-radius: 10px; }
.geo-box .hint { margin: 0; }
.share-result { margin-top: 16px; padding: 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.share-result input { margin-bottom: 10px; font-size: 12.5px; }

/* ------------------------------------------------------------ tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; margin-bottom: 20px; scrollbar-width: thin; }
.tab { padding: 11px 16px; border: 0; background: none; cursor: pointer; color: var(--muted); font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab .count { display: inline-block; margin-left: 6px; font-size: 11px; background: #F1EBE5; color: var(--muted); border-radius: 10px; padding: 0 7px; }
.tab.active .count { background: var(--primary-soft); color: var(--primary-dark); }
.tab-panel[hidden] { display: none; }

/* ------------------------------------------------------------ client detail */
.client-head { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; padding: 24px; }
.client-avatar { width: 64px; height: 64px; border-radius: 16px; background: linear-gradient(145deg, var(--primary), var(--primary-dark)); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 600; flex: none; }
.client-meta { flex: 1; min-width: 260px; }
.client-meta h1 { font-size: 22px; }
.client-meta .company { color: var(--muted); margin-bottom: 12px; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px 24px; }
.meta-item small { display: block; color: var(--muted); font-size: 12px; }
.meta-item div { font-weight: 500; word-break: break-word; }
.client-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 24px 22px; }
.pipeline { display: flex; gap: 4px; padding: 0 24px 22px; overflow-x: auto; }
.pipe-step { flex: 1 0 96px; text-align: center; font-size: 11.5px; color: var(--muted); }
.pipe-step i { display: block; height: 6px; border-radius: 3px; background: #EFE7DF; margin-bottom: 7px; }
.pipe-step.done i { background: var(--accent); } .pipe-step.done { color: var(--text); }
.pipe-step.current i { background: var(--primary); } .pipe-step.current { color: var(--primary); font-weight: 600; }
.pipe-off { padding: 0 24px 22px; }
.detail-list { display: grid; gap: 14px; }
.detail-row { display: flex; gap: 12px; align-items: flex-start; }
.detail-row .ic { color: var(--muted); margin-top: 3px; }
.detail-row small { display: block; color: var(--muted); font-size: 12px; }
.note-item { padding: 14px 0; border-bottom: 1px solid var(--line); }
.note-item:last-child { border-bottom: 0; }
.note-item p { margin: 6px 0; }
.note-meta { font-size: 12px; color: var(--muted); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.media-tile { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #FDFBF9; }
.media-tile img, .media-tile video { width: 100%; height: 120px; object-fit: cover; display: block; background: #EFE7DF; }
.media-tile div { padding: 8px 10px; font-size: 11.5px; color: var(--muted); }
audio { width: 100%; max-width: 320px; height: 36px; }

/* ------------------------------------------------------------ timeline */
.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; position: relative; }
.timeline::before { content: ''; position: absolute; left: 13px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 20px 40px; }
.timeline li:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--card); border: 2px solid var(--line-strong); display: grid; place-items: center; color: var(--primary); }
.tl-time { font-size: 12px; color: var(--muted); }
.tl-text { font-weight: 500; }
.tl-user { font-size: 12px; color: var(--muted); font-weight: 400; }

/* ------------------------------------------------------------ misc */
.pager { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; gap: 10px; }
.pager-info { color: var(--muted); font-size: 12.5px; }
.pager div { display: flex; gap: 4px; }
.pager a { min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; color: var(--text); border: 1px solid var(--line); background: #fff; font-size: 13px; }
.pager a.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.empty-state { text-align: center; padding: 48px 20px; }
.empty-icon { width: 60px; height: 60px; border-radius: 16px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; margin: 0 auto 16px; }
.empty-state h3, .empty-state h2 { margin-bottom: 6px; }
.empty-state p { color: var(--muted); margin-bottom: 18px; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-plain li:last-child { border-bottom: 0; }
.perm-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 18px; }
.perm-groups .check { margin: 3px 0; }
.perm-table td, .perm-table th { text-align: center; } .perm-table td:first-child, .perm-table th:first-child { text-align: left; }
.perm-table input { width: 17px; height: 17px; accent-color: var(--primary); }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.product-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.product-img { height: 160px; background: linear-gradient(145deg, #F4E7DD, #EBD8C9); display: grid; place-items: center; color: var(--primary); }
.product-img img { width: 100%; height: 100%; object-fit: cover; }
.product-body { padding: 16px 18px 18px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.product-body h3 { font-size: 15px; }
.product-price { font-size: 18px; font-weight: 600; color: var(--primary-dark); margin: 4px 0; }
.product-body .btn-group { margin-top: auto; padding-top: 12px; }
.items-table { width: 100%; border-collapse: collapse; }
.items-table th { font-size: 12px; font-weight: 500; color: var(--muted); text-align: left; padding: 0 8px 8px; }
.items-table td { padding: 4px 8px 4px 0; vertical-align: top; }
.items-table input, .items-table select { padding: 8px 10px; font-size: 13px; }
.items-table .line-total { padding-top: 10px; font-weight: 500; white-space: nowrap; text-align: right; }
.totals-box { margin-left: auto; width: 100%; max-width: 340px; margin-top: 16px; }
.totals-box .row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; gap: 14px; }
.totals-box .row input { width: 110px; text-align: right; padding: 6px 10px; }
.totals-box .grand { border-top: 2px solid var(--text); margin-top: 6px; padding-top: 12px; font-size: 17px; font-weight: 600; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 500; }
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; }
.report-tabs { margin-bottom: 20px; }
.bar { height: 8px; border-radius: 5px; background: #EFE7DF; overflow: hidden; min-width: 90px; } .bar span { display: block; height: 100%; background: var(--primary); }

/* ------------------------------------------------------------ documents (quotation / invoice / order) */
.doc { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 40px 44px; max-width: 860px; margin: 0 auto; box-shadow: var(--shadow); }
.doc-head { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 24px; border-bottom: 2px solid var(--primary); flex-wrap: wrap; }
.doc-brand { display: flex; align-items: center; gap: 10px; font-size: 18px; margin-bottom: 6px; }
.logo-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 600; }
.doc-muted { color: var(--muted); font-size: 12.5px; }
.doc-title { text-align: right; } .doc-title h1 { font-size: 26px; color: var(--primary-dark); margin-bottom: 4px; }
.doc-parties { display: flex; justify-content: space-between; gap: 24px; padding: 24px 0; flex-wrap: wrap; }
.doc-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.doc-label.mt { margin-top: 10px; }
.doc-table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.doc-table th { background: var(--bg); text-align: left; padding: 10px 12px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.doc-table td { padding: 12px; border-bottom: 1px solid var(--line); }
.doc-totals { margin-left: auto; max-width: 320px; padding-top: 10px; }
.doc-totals div { display: flex; justify-content: space-between; padding: 6px 0; }
.doc-totals .grand { border-top: 2px solid var(--text); margin-top: 6px; padding-top: 12px; font-size: 18px; font-weight: 600; color: var(--primary-dark); }
.doc-notes { margin-top: 24px; padding: 14px 16px; background: var(--bg); border-radius: 8px; font-size: 13px; }
.doc-foot { text-align: center; margin-top: 32px; color: var(--muted); font-size: 12.5px; }
.doc-bar { max-width: 860px; margin: 0 auto 18px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.doc-bar .spacer { flex: 1; }

/* ------------------------------------------------------------ public / auth pages */
.public-body { background: var(--bg); min-height: 100vh; padding: 32px 16px; }
.public-wrap { max-width: 900px; margin: 0 auto; }
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--card); }
.auth-side { background: linear-gradient(160deg, var(--primary-dark) 0%, var(--sidebar) 78%); color: #fff; padding: 56px 56px 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side::after { content: ''; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; border: 60px solid rgba(217,154,91,.12); }
.auth-side .brand-mark { width: 48px; height: 48px; }
.auth-side h2 { font-size: 34px; font-weight: 600; line-height: 1.25; max-width: 440px; letter-spacing: -.4px; margin: 0 0 14px; }
.auth-side p { color: #D7C8BD; max-width: 420px; }
.auth-points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.auth-points li { display: flex; gap: 12px; align-items: center; color: #E9DDD3; }
.auth-points .ic { color: var(--accent); }
.auth-side small { color: #A29489; position: relative; z-index: 1; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; letter-spacing: -.3px; }
.auth-card > p { color: var(--muted); margin-bottom: 26px; }
.auth-links { display: flex; justify-content: space-between; margin: -4px 0 20px; font-size: 13px; }
.pw-wrap { position: relative; } .pw-wrap .icon-btn { position: absolute; right: 4px; top: 3px; width: 34px; height: 34px; color: var(--muted); }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1180px) { .stats { grid-template-columns: repeat(2, 1fr); } .cols-2 { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; width: 280px; }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(33,26,23,.5); z-index: 35; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-grid; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .cols-2e { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; } .auth-side { display: none; }
  .doc { padding: 24px 18px; } .doc-title { text-align: left; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; } .stat { padding: 14px; gap: 12px; flex-direction: column; align-items: flex-start; } .stat-num { font-size: 22px; }
  .page-head h1 { font-size: 20px; }
  .filters .field { max-width: none; min-width: 45%; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; } .kv dd { margin-bottom: 8px; }
  .items-table thead { display: none; } .items-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); } .items-table td { padding: 0; } .items-table td:first-child, .items-table td.span2 { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ------------------------------------------------------------ print (Download PDF) */
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .doc-bar, .toast-stack, .no-print, .scrim, .alert { display: none !important; }
  .main { margin: 0; } .content, .public-body { padding: 0; max-width: none; }
  .doc { border: 0; box-shadow: none; padding: 0; max-width: none; }
  @page { margin: 14mm; }
}
