/* DUKA app shell — POS-style left sidebar + content frame for the web app. */
:root {
	--dk-ink: #0f172a;
	--dk-muted: #64748b;
	--dk-faint: #94a3b8;
	--dk-line: #ececea;
	--dk-bg: #f7f7f6;
	--dk-brand: #f59e0b;
	--dk-brand-ink: #b45309;
	--dk-brand-bg: #fff7ed;
	--dk-sb-w: 256px;
	--dk-white: #fff;
	--dk-ink-soft: #44403c;
	--dk-hover-bg: #f5f5f4;

	/* Cards / surfaces shared by the dashboard-style pages (/today). */
	--dk-card-bg: var(--dk-white);
	--dk-radius: 14px;
	--dk-radius-lg: 18px;
	--dk-shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 24px -16px rgba(15, 23, 42, 0.14);
	--dk-shadow-tile: 0 4px 8px rgba(168, 101, 28, 0.1), 0 16px 32px -12px rgba(242, 169, 60, 0.32);

	/* Semantic accents — delta pills, sparklines, payment-mix legend. */
	--dk-green: #15803d;
	--dk-green-bg: #f0fdf4;
	--dk-green-line: rgba(21, 128, 61, 0.28);
	--dk-red: #b91c1c;
	--dk-red-bg: #fef2f2;
	--dk-red-line: rgba(185, 28, 28, 0.28);
	--dk-amber-soft: rgba(245, 158, 11, 0.16);
	--dk-blue: #1d4ed8;
	--dk-blue-bg: #eff6ff;
	--dk-skeleton: #eef0ee;
	--dk-skeleton-shine: #f8f8f7;
}

body { background: var(--dk-bg); }

/* Break the shell out of Frappe's centered web container. */
.main-section:has(.dkapp-layout),
.page-content:has(.dkapp-layout),
.page_content:has(.dkapp-layout),
.container:has(.dkapp-layout) {
	max-width: none !important; width: 100% !important; padding: 0 !important; margin: 0 !important;
}
.dkapp-layout ~ footer, footer.web-footer:has(~ .dkapp-layout) { display: none !important; }

/* ---- Sidebar ---- */
.dksb {
	position: fixed; top: 0; left: 0; bottom: 0; width: var(--dk-sb-w); z-index: 60;
	background: var(--dk-white); border-right: 1px solid var(--dk-line);
	display: flex; flex-direction: column; padding: 12px 12px;
}
.dksb__brand { padding: 6px 10px 10px; flex: 0 0 auto; }
.dksb__brand img { height: 28px; width: auto; display: block; }
.dksb__nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.dksb__group {
	font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
	color: var(--dk-faint); padding: 11px 10px 5px;
}
.dksb__link {
	display: flex; align-items: center; gap: 11px;
	padding: 8px 10px; border-radius: 9px; text-decoration: none;
	font-size: 14px; font-weight: 500; color: var(--dk-ink-soft);
	transition: background .12s ease, color .12s ease;
}
.dksb__link:hover { background: var(--dk-hover-bg); color: var(--dk-ink); text-decoration: none; }
.dksb__link.is-active { background: var(--dk-brand-bg); color: var(--dk-brand-ink); font-weight: 600; }
.dksb__ic { flex: 0 0 18px; opacity: .85; }
.dksb__link.is-active .dksb__ic { opacity: 1; }

.dksb__admin { border-top: 1px solid var(--dk-line); margin-top: 6px; padding-top: 2px; }
.dksb__admin .dksb__group { padding-top: 9px; }

.dksb__foot { border-top: 1px solid var(--dk-line); padding-top: 7px; margin-top: 6px; flex: 0 0 auto; }
.dksb__desk {
	display: flex; align-items: center; gap: 11px; padding: 6px 10px; border-radius: 9px;
	font-size: 13.5px; font-weight: 500; color: var(--dk-muted); text-decoration: none;
}
.dksb__desk:hover { background: var(--dk-hover-bg); color: var(--dk-ink); text-decoration: none; }
.dksb__user { display: flex; align-items: center; gap: 10px; padding: 6px 10px; }
.dksb__avatar {
	width: 30px; height: 30px; border-radius: 50%; flex: 0 0 30px;
	background: var(--dk-brand); color: var(--dk-white); font-weight: 700; font-size: 13px;
	display: inline-flex; align-items: center; justify-content: center;
}
.dksb__uname { font-size: 13.5px; font-weight: 600; color: var(--dk-ink); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dksb__logout { color: var(--dk-faint); display: inline-flex; }
.dksb__logout:hover { color: #dc2626; }

/* ---- Main ---- */
.dkapp-main { margin-left: var(--dk-sb-w); min-height: 100vh; }
.dkapp-top { display: none; }
.dkapp-content { max-width: 1080px; margin: 0 auto; padding: 30px 32px 72px; }

/* ---- Section landing ---- */
.dksec__eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--dk-faint); }
.dksec__title { font-size: 27px; font-weight: 700; letter-spacing: -.02em; color: var(--dk-ink); margin: 5px 0 4px; }
.dksec__lede { color: var(--dk-muted); font-size: 14.5px; margin-bottom: 24px; }
.dksec__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 14px; }
.dksec__card { display: block; background: var(--dk-white); border: 1px solid var(--dk-line); border-radius: 14px; padding: 18px; text-decoration: none; transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease; }
.dksec__card:hover { border-color: #ddd9d4; box-shadow: 0 8px 22px -14px rgba(15,23,42,.22); transform: translateY(-1px); text-decoration: none; }
.dksec__card-title { font-size: 15.5px; font-weight: 650; color: var(--dk-ink); }
.dksec__card-sub { font-size: 13px; color: var(--dk-muted); margin-top: 3px; }

/* ---- List pages ---- */
.dklist__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.dklist__new { background: var(--dk-brand); color: var(--dk-white); font-weight: 600; font-size: 13.5px; border: 0; border-radius: 10px; padding: 10px 16px; text-decoration: none; white-space: nowrap; }
.dklist__new:hover { background: #d97706; color: var(--dk-white); text-decoration: none; }
.dklist__search { width: 100%; max-width: 440px; margin-bottom: 16px; border: 1px solid var(--dk-line); border-radius: 10px; padding: 11px 14px; font-size: 14px; background: var(--dk-white); }
.dklist__search:focus { outline: none; border-color: var(--dk-brand); box-shadow: 0 0 0 3px #fef3c7; }
.dklist__rows { background: var(--dk-white); border: 1px solid var(--dk-line); border-radius: 14px; overflow: hidden; }
.dklist__row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; text-decoration: none; color: inherit; }
.dklist__row + .dklist__row { border-top: 1px solid #f4f4f2; }
.dklist__row:hover { background: #fafaf9; text-decoration: none; }
.dklist__name { font-weight: 600; color: var(--dk-ink); font-size: 14px; }
.dklist__meta { color: var(--dk-muted); font-size: 12.5px; margin-top: 1px; }
.dklist__tag { margin-left: auto; font-size: 12.5px; color: var(--dk-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dklist__empty { padding: 48px 16px; text-align: center; color: var(--dk-faint); font-size: 14px; }

/* ---- Today dashboard (/today) ---- */
.dktoday { max-width: 1180px; margin: 0 auto; padding-bottom: 24px; }

.dktoday__head { margin-bottom: 28px; }
.dktoday__eyebrow {
	font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
	color: var(--dk-brand-ink);
}
.dktoday__head h1 { font-size: 34px; letter-spacing: -0.03em; margin: 6px 0 6px; font-weight: 700; color: var(--dk-ink); }
.dktoday__head p { color: var(--dk-muted); margin: 0; font-size: 15px; }

.dktoday__noscript {
	background: var(--dk-brand-bg); border: 1px solid var(--dk-brand); border-radius: var(--dk-radius);
	padding: 16px 18px; margin-bottom: 20px; color: var(--dk-brand-ink); font-size: 13.5px;
}
.dktoday__noscript-stats { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; font-weight: 600; color: var(--dk-ink); }

.dktoday__err {
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	background: var(--dk-red-bg); border: 1px solid var(--dk-red-line); color: var(--dk-red);
	border-radius: 10px; padding: 10px 14px; font-size: 13px; font-weight: 500; margin-bottom: 18px;
}
.dktoday__err[hidden] { display: none; }
.dktoday__err button {
	background: var(--dk-white); border: 1px solid var(--dk-red-line); color: var(--dk-red); font-weight: 600;
	font-size: 12.5px; border-radius: 999px; padding: 5px 12px; cursor: pointer; white-space: nowrap;
}
.dktoday__err button:hover { background: var(--dk-red-bg); }

/* KPI strip */
.dkkpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.dkkpi__card {
	background: var(--dk-card-bg); border: 1px solid var(--dk-line); border-radius: var(--dk-radius);
	padding: 18px 20px; box-shadow: var(--dk-shadow-card); position: relative; overflow: hidden;
}
.dkkpi__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.dkkpi__label {
	font-size: 10.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--dk-faint);
}
.dkkpi__delta {
	font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; white-space: nowrap;
	font-variant-numeric: tabular-nums;
}
.dkkpi__delta[data-dir="up"] { color: var(--dk-green); background: var(--dk-green-bg); }
.dkkpi__delta[data-dir="down"] { color: var(--dk-red); background: var(--dk-red-bg); }
.dkkpi__delta[data-dir="flat"] { color: var(--dk-muted); background: var(--dk-bg); }
.dkkpi__value {
	font-size: 25px; font-weight: 700; letter-spacing: -0.02em; color: var(--dk-ink); margin-top: 10px;
	font-variant-numeric: tabular-nums; line-height: 1.15;
}
.dkkpi__value small { font-size: 13px; font-weight: 600; color: var(--dk-faint); margin-right: 2px; }
.dkkpi__sub { font-size: 12px; color: var(--dk-muted); margin-top: 3px; }
.dkkpi__spark { position: absolute; right: 14px; bottom: 12px; width: 68px; height: 26px; opacity: 0.9; }
.dkkpi__spark path { fill: none; stroke: var(--dk-brand); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dkkpi__spark.is-down path { stroke: var(--dk-faint); }
.dkkpi__spark circle { fill: var(--dk-brand); }
.dkkpi__card--warn .dkkpi__value { color: var(--dk-brand-ink); }
.dkkpi__dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dkkpi__dot--ok { background: var(--dk-green); }
.dkkpi__dot--warn { background: var(--dk-brand); }

/* Analytics row: chart + payment mix */
.dkgrid-2 { display: grid; grid-template-columns: 1.62fr 1fr; gap: 14px; margin-bottom: 14px; align-items: stretch; }
.dkcard {
	background: var(--dk-card-bg); border: 1px solid var(--dk-line); border-radius: var(--dk-radius);
	padding: 20px 22px; box-shadow: var(--dk-shadow-card);
}
.dkcard__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.dkcard__title { font-size: 14.5px; font-weight: 650; color: var(--dk-ink); }
.dkcard__sub { font-size: 12px; color: var(--dk-faint); margin-top: 2px; }

.dkchart__bars { display: flex; align-items: flex-end; gap: 10px; height: 132px; }
.dkchart__col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 8px; }
.dkchart__bar-wrap { flex: 1; display: flex; align-items: flex-end; width: 100%; justify-content: center; }
.dkchart__bar {
	width: 60%; min-width: 10px; border-radius: 5px 5px 2px 2px; background: var(--dk-amber-soft);
	transition: background 0.15s ease, transform 0.15s ease; cursor: default;
}
.dkchart__bar:hover { transform: scaleY(1.02); }
.dkchart__col.is-today .dkchart__bar { background: var(--dk-brand); }
.dkchart__day { font-size: 11px; color: var(--dk-faint); font-weight: 600; }
.dkchart__col.is-today .dkchart__day { color: var(--dk-brand-ink); }

.dkmix__ring-wrap { display: flex; align-items: center; gap: 18px; }
.dkmix__ring { flex: 0 0 auto; }
.dkmix__ring-total { font-size: 15px; font-weight: 700; color: var(--dk-ink); }
.dkmix__ring-label { font-size: 9.5px; color: var(--dk-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.dkmix__legend { flex: 1; display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.dkmix__row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.dkmix__swatch { width: 8px; height: 8px; border-radius: 2px; flex: 0 0 auto; }
.dkmix__row-label { color: var(--dk-muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dkmix__row-val { color: var(--dk-ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Actions + recent activity row */
.dkgrid-2b { display: grid; grid-template-columns: 1.62fr 1fr; gap: 14px; margin-bottom: 24px; align-items: stretch; }
.dktiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.dktile {
	display: flex; flex-direction: column; align-items: flex-start; text-align: left;
	padding: 18px 18px; border-radius: var(--dk-radius-lg); background: var(--dk-card-bg);
	border: 1px solid var(--dk-line); box-shadow: var(--dk-shadow-card); text-decoration: none; color: inherit;
	transition: transform 0.12s ease, box-shadow 0.18s ease, border-color 0.15s ease; min-height: 120px;
}
.dktile:hover, .dktile:focus-visible {
	transform: translateY(-2px); border-color: var(--dk-brand); text-decoration: none; outline: none;
	box-shadow: var(--dk-shadow-tile);
}
.dktile__kicker { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; color: var(--dk-faint); margin-bottom: 16px; font-variant-numeric: tabular-nums; }
.dktile__title { font-size: 18px; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 4px; }
.dktile__sub { font-size: 12.5px; opacity: 0.75; line-height: 1.4; }
.dktile--brand { background: linear-gradient(135deg, var(--dk-brand) 0%, var(--dk-brand-ink) 100%); color: var(--dk-white); border-color: transparent; }
.dktile--brand:hover { filter: brightness(1.04); border-color: transparent; }
.dktile--brand .dktile__kicker { color: rgba(255, 255, 255, 0.72); }
.dktile--brand .dktile__sub { opacity: 0.88; }

.dkactivity__list { display: flex; flex-direction: column; }
.dkactivity__row {
	display: flex; align-items: center; gap: 10px; padding: 10px 0; text-decoration: none; color: inherit;
}
.dkactivity__row + .dkactivity__row { border-top: 1px solid #f4f4f2; }
.dkactivity__row:hover .dkactivity__name { color: var(--dk-brand-ink); }
.dkactivity__avatar {
	width: 30px; height: 30px; border-radius: 50%; flex: 0 0 30px; background: var(--dk-bg); color: var(--dk-muted);
	font-weight: 700; font-size: 12px; display: inline-flex; align-items: center; justify-content: center;
}
.dkactivity__body { flex: 1; min-width: 0; }
.dkactivity__name { font-size: 13.5px; font-weight: 600; color: var(--dk-ink); transition: color 0.12s ease; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dkactivity__meta { font-size: 11.5px; color: var(--dk-faint); margin-top: 1px; }
.dkactivity__amount { font-size: 13.5px; font-weight: 700; color: var(--dk-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dkactivity__amount--return { color: var(--dk-red); }

/* Empty / error states inside cards */
.dkempty { text-align: center; padding: 22px 8px; color: var(--dk-faint); }
.dkempty__icon { color: var(--dk-line); margin-bottom: 10px; }
.dkempty__title { font-size: 13.5px; font-weight: 600; color: var(--dk-muted); }
.dkempty__sub { font-size: 12px; margin-top: 3px; }
.dkempty__cta {
	display: inline-block; margin-top: 12px; font-size: 12.5px; font-weight: 600; color: var(--dk-brand-ink);
	text-decoration: none; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--dk-brand);
}
.dkempty__cta:hover { background: var(--dk-brand-bg); text-decoration: none; }

/* Skeleton loading state — shimmer bars, never a blank screen */
.is-skeleton { pointer-events: none; }
.dkskel {
	background: linear-gradient(100deg, var(--dk-skeleton) 30%, var(--dk-skeleton-shine) 50%, var(--dk-skeleton) 70%);
	background-size: 220% 100%; animation: dkshimmer 1.3s ease-in-out infinite; border-radius: 6px;
}
@keyframes dkshimmer { 0% { background-position: 120% 0; } 100% { background-position: -20% 0; } }
.dkkpi__card.is-skeleton .dkskel--label { width: 70px; height: 9px; margin-bottom: 4px; }
.dkkpi__card.is-skeleton .dkskel--value { width: 96px; height: 22px; margin-top: 12px; }
.dkkpi__card.is-skeleton .dkskel--sub { width: 60px; height: 8px; margin-top: 8px; }
.dkcard.is-skeleton .dkskel--chart { width: 100%; height: 132px; }
.dkcard.is-skeleton .dkskel--ring { width: 96px; height: 96px; border-radius: 50%; }
.dkcard.is-skeleton .dkskel--row { width: 100%; height: 13px; margin: 10px 0; }

/* Utility chip row (existing quick-add links) */
.dktoday__more { display: flex; flex-wrap: wrap; gap: 8px; }
.dktoday__more-link {
	display: inline-block; padding: 10px 16px; border-radius: 999px; background: var(--dk-card-bg);
	border: 1px solid var(--dk-line); font-size: 13px; font-weight: 500; color: var(--dk-muted);
	text-decoration: none; transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.dktoday__more-link:hover, .dktoday__more-link:focus-visible { background: var(--dk-white); border-color: var(--dk-brand); color: var(--dk-ink); outline: none; text-decoration: none; }

/* ---- Mobile ---- */
@media (max-width: 880px) {
	.dksb { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(15,23,42,.15); }
	.dksb.is-open { transform: translateX(0); }
	.dkapp-main { margin-left: 0; }
	.dkapp-top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--dk-white); border-bottom: 1px solid var(--dk-line); position: sticky; top: 0; z-index: 40; }
	.dkapp-top__menu { background: none; border: 0; color: var(--dk-ink); display: inline-flex; padding: 4px; }
	.dkapp-top__brand img { height: 24px; }
	.dkapp-content { padding: 20px 16px 56px; }

	.dkkpi { grid-template-columns: repeat(2, 1fr); }
	.dkgrid-2, .dkgrid-2b { grid-template-columns: 1fr; }
	.dktiles { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
	.dktoday__head h1 { font-size: 26px; }
	.dktoday__head p { font-size: 13.5px; }
	.dkkpi { grid-template-columns: repeat(2, 1fr); gap: 8px; }
	.dkkpi__card { padding: 14px 14px; }
	.dkkpi__value { font-size: 20px; }
	.dkkpi__spark { display: none; }
	.dkcard { padding: 16px 16px; }
	.dktiles { grid-template-columns: 1fr; }
	.dktile { min-height: 100px; padding: 16px 16px; }
	.dktile__kicker { margin-bottom: 12px; }
	.dktile__title { font-size: 16px; }
}
