/* ==========================================================================
   KnowMore push suite - shared styles (light + dark) & responsive rules
   ========================================================================== */

/* ---------- Layout helpers ---------- */
.km-wrap { max-width: 1180px; }
.km-page-title { margin: 6px 0 2px; font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.km-sub { color: #696969; font-size: 13px; margin: 0 0 14px; }
.km-clearfix:after { content: ""; display: table; clear: both; }

.km-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 14px; }
.km-row-end { justify-content: space-between; }
.km-spacer { flex: 1 1 auto; }

/* ---------- Chips / tags / badges ---------- */
.km-chip {
	display: inline-block; background: #EFEEFC; color: #6358DE; border-radius: 999px;
	padding: 5px 14px; font-size: 12px; font-weight: 700; margin: 0 6px 6px 0;
	text-decoration: none; border: 0; cursor: pointer;
}
.km-chip:hover { background: #DDD8F7; text-decoration: none; }
.km-chip-on { background: #6358DE; color: #fff; }
.km-chip-on:hover { background: #544bc9; color: #fff; }

.km-tag { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 4px; padding: 2px 7px; white-space: nowrap; }
.km-tag-web { background: #EFEEFC; color: #6358DE; }
.km-tag-android { background: #E6F5EF; color: #0B996F; }
.km-tag-ios { background: #F0F0F0; color: #1B1B1B; }
.km-tag-all { background: #E8F1FD; color: #1763C6; }
.km-tag-rss { background: #FFF3E0; color: #B25E00; }
.km-tag-youtube { background: #FDE7E7; color: #C0392B; }
.km-tag-auto { background: #E6F5EF; color: #0B996F; }
.km-tag-drip { background: #F3E8FD; color: #7B2FA8; }

.km-status { font-size: 12px; font-weight: 700; white-space: nowrap; }
.km-status-ok { color: #0B996F; }
.km-status-off { color: #8a8a8a; }
.km-status-warn { color: #C77700; }
.km-muted { color: #737373; font-size: 12px; }

/* ---------- Cards ---------- */
.km-cards { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 18px; }
.km-card {
	background: #fff; border: 1px solid #E6E4F5; border-radius: 10px; padding: 14px 16px;
	flex: 1 1 200px; min-width: 180px; box-shadow: 0 1px 2px rgba(20, 20, 60, .04);
}
.km-card-num { font-size: 28px; font-weight: 700; color: #1B1B1B; line-height: 1.1; }
.km-card-label { font-size: 12px; font-weight: 700; color: #737373; text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.km-card-foot { font-size: 12px; color: #737373; margin-top: 6px; }
.km-card-purple .km-card-num { color: #6358DE; }
.km-card-green .km-card-num { color: #0B996F; }
.km-card-orange .km-card-num { color: #C77700; }

.km-panel {
	background: #fff; border: 1px solid #E6E4F5; border-radius: 10px; padding: 16px 18px; margin: 0 0 16px;
}
.km-panel > h3, .km-panel > h4 { margin-top: 0; }

/* ---------- Tables ---------- */
.km-table { width: 100%; }
.km-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #737373; font-weight: 700; }
.km-table td { vertical-align: top; }
.km-actions { text-align: right; white-space: nowrap; }
.km-actions form { display: inline; }

/* ---------- Forms ---------- */
.km-form label { font-weight: 700; font-size: 13px; display: block; margin: 0 0 4px; }
.km-form .km-field { margin-bottom: 12px; }
.km-form .km-hint { font-size: 12px; color: #737373; margin: 2px 0 0; }
.km-form input[type=text], .km-form input[type=url], .km-form input[type=password],
.km-form input[type=number], .km-form select, .km-form textarea { width: 100%; max-width: 560px; box-sizing: border-box; }
.km-form textarea { min-height: 90px; }
.km-inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 14px; }
.km-inline-form .km-field { margin: 0; }
.km-inline-form input[type=text], .km-inline-form input[type=url], .km-inline-form select { width: auto; min-width: 180px; }
.km-check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.km-check input { margin-top: 3px; }

/* ---------- Step builder (drips) ---------- */
.km-step {
	border: 1px solid #E6E4F5; border-left: 4px solid #6358DE; border-radius: 8px;
	padding: 12px 14px; margin-bottom: 12px; background: #FBFAFF;
}
.km-step-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.km-step-num {
	background: #6358DE; color: #fff; border-radius: 50%; width: 22px; height: 22px;
	display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.km-step-title { font-weight: 700; }

/* ---------- Code / snippet blocks ---------- */
.km-code {
	background: #1B1B2A; color: #E8E6F7; border-radius: 8px; padding: 12px 14px; font-size: 12px;
	overflow-x: auto; white-space: pre; margin: 0 0 10px; font-family: "SFMono-Regular", Consolas, Menlo, monospace;
}
.km-code-wrap { position: relative; }

/* ---------- Prompt preview ---------- */
.km-prompt-preview {
	border: 2px dashed #C9C4EE; border-radius: 12px; padding: 18px; background: #FBFAFF; max-width: 420px;
}
.km-prompt-preview h4 { margin: 0 0 6px; }
.km-prompt-btns { margin-top: 12px; display: flex; gap: 8px; }

/* ---------- Stat bars ---------- */
.km-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.km-bar-label { width: 130px; font-size: 13px; font-weight: 600; flex: 0 0 auto; }
.km-bar-track { flex: 1 1 auto; background: #EFEEFC; border-radius: 999px; height: 14px; overflow: hidden; }
.km-bar-fill { background: #6358DE; height: 100%; border-radius: 999px; }
.km-bar-val { width: 62px; text-align: right; font-size: 12px; font-weight: 700; color: #1B1B1B; flex: 0 0 auto; }

/* ---------- Empty state ---------- */
.km-empty {
	border: 1px dashed #C9C4EE; border-radius: 10px; padding: 22px; text-align: center; color: #6b6b6b;
	background: #FBFAFF; margin-bottom: 16px;
}

/* ---------- Toast (instant delivery notice) ---------- */
#km-toast {
	position: fixed; right: 16px; bottom: 16px; z-index: 9999; max-width: 320px;
	background: #1B1B2A; color: #fff; border-radius: 10px; padding: 12px 14px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, .25); display: none; font-size: 13px;
}
#km-toast.km-toast-on { display: block; }
#km-toast .km-toast-title { font-weight: 700; margin-bottom: 2px; }

/* ---------- Mobile nav toggle (hidden on desktop) ---------- */
#km-nav-toggle {
	display: none; background: #6358DE; color: #fff; border: 0; border-radius: 6px;
	padding: 8px 12px; font-size: 14px; font-weight: 700; margin: 0 0 10px; cursor: pointer;
}
.km-nav-backdrop {
	display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 1030;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media only screen and (max-width: 979px) {
	.km-card { flex: 1 1 45%; }
	.km-bar-label { width: 96px; }
}

@media only screen and (max-width: 767px) {
	/* Off-canvas sidebar */
	body > div.container-fluid > div.row-fluid > div.span2 {
		display: none; position: fixed; top: 0; left: 0; bottom: 0; width: 260px; z-index: 1040;
		background: #fff; overflow-y: auto; padding: 10px; margin: 0;
		box-shadow: 4px 0 18px rgba(0, 0, 0, .18);
	}
	body > div.container-fluid > div.row-fluid > div.span2.km-nav-open { display: block !important; }
	.km-nav-backdrop.km-nav-open { display: block; }
	body > div.container-fluid > div.row-fluid > div.span10 { width: 100%; margin-left: 0; float: none; }

	#km-nav-toggle { display: inline-block; }
	body > div.container-fluid > div.row-fluid > div.span2 #km-nav-toggle { display: none; }

	/* Page furniture */
	.km-page-title { font-size: 21px; }
	.km-sub { font-size: 12px; }
	.km-panel { padding: 13px 14px; }
	.km-cards { gap: 10px; }
	.km-card { flex: 1 1 100%; min-width: 0; }
	.km-card-num { font-size: 24px; }

	/* Buttons / chips go full width and comfortable */
	.btn { padding: 8px 12px; font-size: 13px; }
	.btn-mini { padding: 6px 10px; font-size: 12px; }
	.km-chip { padding: 7px 13px; }
	.km-row .btn { margin: 0 0 6px; }

	/* Tables: horizontal scroll instead of squashing */
	.km-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
	.km-table { min-width: 620px; }
	.km-actions { text-align: left; }
	.km-actions .btn { margin-bottom: 4px; }

	/* Forms */
	.km-form input[type=text], .km-form input[type=url], .km-form input[type=password],
	.km-form input[type=number], .km-form select, .km-form textarea,
	.km-inline-form input[type=text], .km-inline-form input[type=url], .km-inline-form select {
		width: 100%; max-width: none; min-width: 0;
	}
	.km-inline-form { flex-direction: column; align-items: stretch; }
	.km-inline-form .km-field { width: 100%; }
	.km-inline-form .btn { width: 100%; }

	/* Code blocks */
	.km-code { font-size: 11px; padding: 10px; }

	/* Prompt preview */
	.km-prompt-preview { max-width: none; }

	/* Toast */
	#km-toast { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}

@media only screen and (max-width: 480px) {
	.km-bar-row { flex-wrap: wrap; }
	.km-bar-label { width: 100%; }
	.km-bar-val { width: auto; }
	.km-step-head { flex-direction: column; align-items: flex-start; }
}

/* ==========================================================================
   Dark mode
   ========================================================================== */
body.dark .km-sub, body.dark .km-muted, body.dark .km-card-label, body.dark .km-card-foot,
body.dark .km-form .km-hint { color: #A0A0A0; }
body.dark .km-card, body.dark .km-panel { background: #23232E; border-color: #35354A; }
body.dark .km-card-num { color: #F2F1F9; }
body.dark .km-chip { background: #35354A; color: #B9B2F5; }
body.dark .km-chip:hover { background: #44445C; }
body.dark .km-chip-on { background: #6358DE; color: #fff; }
body.dark .km-step { background: #26263A; border-color: #35354A; }
body.dark .km-bar-track { background: #35354A; }
body.dark .km-bar-val { color: #F2F1F9; }
body.dark .km-empty { background: #23232E; border-color: #44445C; color: #B0AFC4; }
body.dark .km-table th { color: #A0A0A0; }
body.dark .km-prompt-preview { background: #23232E; border-color: #44445C; }
body.dark .km-tag-ios { background: #44445C; color: #F2F1F9; }
body.dark .km-tag-web { background: #35354A; color: #B9B2F5; }
body.dark .km-tag-android { background: #24423A; color: #6FD3A8; }
body.dark .km-tag-all { background: #22354D; color: #8FC0F5; }
body.dark .km-tag-rss { background: #4A3A22; color: #F0C070; }
body.dark .km-tag-youtube { background: #4A2A2A; color: #F09090; }
body.dark .km-tag-drip { background: #3E2A4D; color: #D3A8F5; }
body.dark .km-status-off { color: #9A9A9A; }

/* ==========================================================================
   Core app layout - responsive refinements
   ========================================================================== */

/* The fixed top bar needs room for its content on small screens */
@media only screen and (max-width: 767px) {
	.navbar-fixed-top { margin-bottom: 0; }
	.navbar-fixed-top .navbar-inner { padding: 0 8px; min-height: 44px; }
	.navbar .brand { font-size: 15px; padding: 8px 10px; }
	.navbar .btn-navbar { margin: 6px 4px; }
	.navbar-fixed-top .container-fluid { padding: 0; }

	/* Push the content below the fixed bar */
	body > div.container-fluid { padding-top: 46px; }

	/* Page furniture */
	.container-fluid { padding-left: 10px; padding-right: 10px; }
	.lead { font-size: 16px; margin-bottom: 6px; }
	h2 { font-size: 20px; }
	h3 { font-size: 16px; }
	.row-fluid [class*="span"] { float: none; width: 100%; margin-left: 0; }

	/* Bootstrap 2 forms stack */
	.form-horizontal .control-label {
		float: none; display: block; width: auto; text-align: left; padding-top: 0; margin-bottom: 4px;
	}
	.form-horizontal .controls {
		margin-left: 0 !important; display: block; width: 100%;
	}
	.form-horizontal .controls input[type=text],
	.form-horizontal .controls input[type=url],
	.form-horizontal .controls input[type=password],
	.form-horizontal .controls input[type=email],
	.form-horizontal .controls input[type=number],
	.form-horizontal .controls select,
	.form-horizontal .controls textarea { width: 100%; max-width: none; }
	.control-group { margin-bottom: 12px; }
	.input-append input[type=number] { width: 70px; }

	/* Tables scroll horizontally rather than overflow the screen */
	.table { margin-bottom: 8px; }
	.table th, .table td { padding: 6px 7px; font-size: 12px; }

	/* Modals and alerts */
	.modal { width: auto; margin: 10px; }
	.alert { padding: 10px 12px; font-size: 13px; }

	/* Buttons */
	.btn-large { padding: 10px 16px; font-size: 15px; }
	.btn { margin-bottom: 4px; }

	/* Dashboard brand header */
	.km-brand-meta .km-badge { display: inline-block; margin: 2px 4px 2px 0; font-size: 11px; }

	/* Growth chart bars stay readable */
	.km-chart { height: 90px; }
	.km-bar-wrap { width: 8px; }
}

@media only screen and (max-width: 480px) {
	body > div.container-fluid { padding-top: 42px; }
	.km-card { padding: 12px 13px; }
	.km-card-num { font-size: 22px; }
	.km-card-label { font-size: 11px; }
	.km-panel { padding: 12px 13px; border-radius: 8px; }
	.km-code { font-size: 10px; padding: 9px; border-radius: 6px; }
	#km-nav-toggle { width: 100%; }
	.btn { width: auto; }
	table .btn { width: auto; }
}

/* ==========================================================================
   Dark mode tweaks for the mobile nav and core chrome
   ========================================================================== */
body.dark #km-nav-toggle { background: #6358DE; }
body.dark #km-nav-close { background: #35354A; color: #F2F1F9; border-color: #44445C; }
body.dark .km-nav-backdrop { background: rgba(0, 0, 0, .6); }
body.dark .km-panel .table th { color: #A0A0A0; }

/* ==========================================================================
   Off-canvas drawer contents
   ========================================================================== */
@media only screen and (max-width: 767px) {
	body > div.container-fluid > div.row-fluid > div.span2 .sidebar-nav { width: 100%; margin: 0; padding: 0; }
	body > div.container-fluid > div.row-fluid > div.span2 .nav-list > li > a {
		padding: 10px 12px; font-size: 14px; border-radius: 6px;
	}
	body > div.container-fluid > div.row-fluid > div.span2 .nav-header {
		padding: 10px 12px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
	}
	body > div.container-fluid > div.row-fluid > div.span2 .km-tasks { margin: 0 0 12px; }
	body > div.container-fluid > div.row-fluid > div.span2 .sidebar-box { padding: 0; border: 0; background: transparent; box-shadow: none; }
	#km-nav-close { display: block !important; width: 100%; margin-bottom: 10px; }
}

/* The close button only exists inside the mobile drawer */
@media only screen and (min-width: 768px) {
	#km-nav-close { display: none !important; }
	#km-nav-toggle { display: none !important; }
}

/* ==========================================================================
   Public pages (plans, subscribe link, install) stay comfortable on phones
   ========================================================================== */
@media only screen and (max-width: 767px) {
	.km-plans-grid, .plans-grid { grid-template-columns: 1fr !important; }
	.km-plan-card { width: 100% !important; }
}

/*--------------------------------------------------------------
  Sendy 7.0.3 - sidebar keeps a 220px minimum width so nav text
  is never truncated on narrower desktop viewports
--------------------------------------------------------------*/
body > div.container-fluid > div.row-fluid > div.span2 {
	min-width: 220px;
}

@media (max-width: 979px) and (min-width: 768px) {
	body > div.container-fluid > div.row-fluid > div.span2 {
		min-width: 180px;
	}
}

/*--------------------------------------------------------------
  Sendy 7.0 - report stat cards (CTOR, card layout)
--------------------------------------------------------------*/
.badge-ctor {
	background-color: #6358DE;
	color: #fff;
}
body.dark .badge-ctor {
	background-color: #7c71e8;
	color: #fff;
}

/*--------------------------------------------------------------
  OneSignal-parity push layer - filter builder, journeys, A/B,
  in-app, SMS and the small utility classes the new pages use.
--------------------------------------------------------------*/
.km-plain-list { margin: 0 0 12px 18px; padding: 0; }
.km-plain-list li { margin-bottom: 6px; list-style: disc; }
.km-pre {
	background: #f6f6f9; border: 1px solid #e2e2ea; border-radius: 4px;
	padding: 10px 12px; font-size: 12px; line-height: 1.5; overflow-x: auto;
	font-family: Menlo, Consolas, monospace;
}
body.dark .km-pre { background: #23232b; border-color: #34343e; color: #d8d8e0; }

/* --- filter builder ------------------------------------------------------- */
.km-filter { border: 1px solid #e2e2ea; border-radius: 5px; padding: 12px; background: #fbfbfd; }
body.dark .km-filter { background: #23232b; border-color: #34343e; }
.km-filter-row, .km-filter-group { margin-bottom: 8px; }
.km-filter-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.km-filter-row select, .km-filter-row input { margin-bottom: 0; max-width: 190px; }
.km-filter-group { border-left: 3px solid #6358DE; padding-left: 10px; }
.km-filter-group.km-filter-or { border-left-color: #3aa757; }
.km-filter-grouphead { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.km-filter-grouphead strong { font-size: 11px; letter-spacing: .06em; color: #6358DE; }
.km-filter-group.km-filter-or .km-filter-grouphead strong { color: #3aa757; }
.km-filter-children { padding-left: 4px; }
.km-filter-actions { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.km-filter-tagname { max-width: 130px !important; }

/* --- journeys ------------------------------------------------------------- */
.km-journey-node {
	border: 1px solid #e2e2ea; border-radius: 6px; margin-bottom: 12px; background: #fff;
}
body.dark .km-journey-node { background: #23232b; border-color: #34343e; }
.km-journey-node-head {
	display: flex; justify-content: space-between; align-items: center; gap: 8px;
	padding: 8px 10px; border-bottom: 1px solid #eee; background: #fafafc;
	border-radius: 6px 6px 0 0;
}
body.dark .km-journey-node-head { background: #2b2b34; border-color: #34343e; }
.km-journey-node-head select { width: auto; margin: 0; }
.km-journey-body { padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.km-journey-body > input, .km-journey-body > textarea { margin-bottom: 0; }
.km-journey-wait { font-weight: normal; font-size: 12px; }
.km-journey-wait input { width: 70px; display: inline-block; margin: 0 4px; }
.km-journey-condition, .km-journey-next {
	display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px;
}
.km-journey-condition select, .km-journey-next select { width: auto; margin: 0; max-width: 180px; }
.km-journey-condition input { width: 110px; margin: 0; }
.km-journey-branches { display: flex; gap: 10px; }
.km-journey-branches label { font-weight: normal; margin: 0; }
/* Only the controls a node type actually uses are shown. */
.km-journey-node[data-kind="wait"] .km-journey-body > input[type="text"],
.km-journey-node[data-kind="wait"] .km-journey-body > textarea,
.km-journey-node[data-kind="exit"] .km-journey-body > * { display: none; }
.km-journey-node[data-kind="branch"] .km-journey-wait,
.km-journey-node[data-kind="tag"] .km-journey-wait { display: none; }
.km-journey-node:not([data-kind="branch"]) .km-journey-branches { display: none; }

/* --- A/B variants --------------------------------------------------------- */
.km-ab-variant {
	border: 1px solid #e2e2ea; border-radius: 6px; padding: 10px; margin-bottom: 10px;
	display: flex; flex-direction: column; gap: 6px; background: #fbfbfd;
}
body.dark .km-ab-variant { background: #23232b; border-color: #34343e; }
.km-ab-variant strong { font-size: 12px; color: #6358DE; }
.km-ab-variant input, .km-ab-variant textarea { margin-bottom: 0; }

/* --- rich-content editor -------------------------------------------------- */
.km-platform-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.km-platform-card {
	flex: 1 1 200px; border: 1px solid #e2e2ea; border-radius: 6px; padding: 10px;
	display: flex; flex-direction: column; gap: 6px;
}
body.dark .km-platform-card { border-color: #34343e; }
.km-platform-card h5 { margin: 0 0 2px 0; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.km-platform-card input { margin-bottom: 0; }
.km-button-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.km-button-row input { margin-bottom: 0; }

/*--------------------------------------------------------------
  Mobile layout fixes (<= 767px)
  - Top bar sticks to the top and never overlaps page content
  - Nothing pushes the page wider than the screen
--------------------------------------------------------------*/
@media only screen and (max-width: 767px) {
	html, body { overflow-x: hidden; }
	body { padding-top: 0 !important; padding-bottom: 20px; }
	body > div.container-fluid { padding-top: 12px !important; }

	.navbar-fixed-top {
		position: -webkit-sticky; position: sticky; top: 0; z-index: 1030;
		margin: 0 -10px 0 !important;
	}
	.navbar-fixed-top .navbar-inner { padding: 6px 8px; min-height: 0; }
	.navbar-fixed-top .container-fluid { display: flex; align-items: center; gap: 6px; padding: 0; }
	.navbar-fixed-top .btn-navbar, .navbar-fixed-top .nav-collapse { display: none !important; }
	.navbar .brand {
		float: none; order: 0; flex: 1 1 auto; min-width: 0; margin: 0 !important; padding: 6px 4px;
		white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
	}
	.navbar .brand .main-gravatar { flex: none; }
	.navbar-fixed-top .btn-group.pull-right { float: none; flex: 0 1 auto; min-width: 0; margin: 0 !important; }
	.navbar-fixed-top .btn-group.pull-right:last-of-type { order: 1; }
	.navbar-fixed-top .btn-group:not(:last-of-type) { order: 2; }
	.navbar-fixed-top .btn-group > .btn {
		max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
		padding: 6px 9px; margin: 0;
	}
	.navbar-fixed-top .dropdown-menu { right: 0; left: auto; max-height: 70vh; overflow-y: auto; }

	#km-nav-toggle { display: block; width: 100%; margin: 0 0 12px; }

	/* Media, wide blocks and form fields fit the screen */
	img, iframe, video { max-width: 100%; }
	.span10 input[type=text], .span10 input[type=url], .span10 input[type=email], .span10 input[type=search],
	.span10 input[type=password], .span10 input[type=number], .span10 input[type=date], .span10 select, .span10 textarea {
		max-width: 100%; box-sizing: border-box; font-size: 16px; /* 16px stops iOS zooming on focus */
	}
	.span10 input[type=text], .span10 input[type=url], .span10 input[type=email], .span10 input[type=search],
	.span10 input[type=password], .span10 input[type=date], .span10 select { height: 38px; line-height: 20px; }
	.span10 form input[type=text], .span10 form input[type=url], .span10 form input[type=email],
	.span10 form input[type=password], .span10 form select, .span10 form textarea { width: 100%; }
	.span10 textarea { min-height: 80px; }
	.span10 table input[type=text], .span10 table select { width: auto; }
	.span10 .input-append, .span10 .input-prepend { display: flex; max-width: 100%; }
	.span10 .input-append input, .span10 .input-prepend input { flex: 1 1 auto; min-width: 0; }
	.span10 pre, .span10 code { white-space: pre-wrap; word-break: break-all; }

	.span10 .well, .span10 .row-fluid.well { max-width: 100%; box-sizing: border-box; }
	.span10 .well [class*="span"] { min-width: 0; }
	.span10 .controls { max-width: 100%; }
}

/* Tables scroll sideways inside their own box (wrapper added by main.js) */
.km-auto-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.km-auto-scroll > table { margin-bottom: 8px; }
@media only screen and (max-width: 979px) {
	.span10 textarea, .span10 input, .span10 select { max-width: 100%; box-sizing: border-box; }
	.span10 .well { max-width: 100%; box-sizing: border-box; overflow-wrap: anywhere; }
}

/*--------------------------------------------------------------
  Desktop/tablet: sidebar keeps its minimum width without pushing
  the main column below it (floats + min-width used to wrap).
--------------------------------------------------------------*/
@media only screen and (min-width: 768px) {
	body > div.container-fluid > div.row-fluid { display: flex; align-items: flex-start; }
	body > div.container-fluid > div.row-fluid::before,
	body > div.container-fluid > div.row-fluid::after { display: none; }
	body > div.container-fluid > div.row-fluid > div.span2 { flex: 0 0 220px; width: 220px; float: none; }
	body > div.container-fluid > div.row-fluid > div.span10 { flex: 1 1 auto; width: auto; min-width: 0; float: none; margin-left: 24px; }
}
@media (max-width: 979px) and (min-width: 768px) {
	body > div.container-fluid > div.row-fluid > div.span2 { flex-basis: 180px; width: 180px; }
	body > div.container-fluid > div.row-fluid > div.span10 { margin-left: 16px; }
}

/* Any table wrapper scrolls rather than overflowing, at every width */
.km-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media only screen and (max-width: 979px) {
	.km-button-row { flex-wrap: wrap; }
	.km-button-row input[type=text] { flex: 1 1 140px; width: auto !important; min-width: 0; }
}

/* Side-by-side panels: let wide tables scroll inside the panel instead of
   stretching it past the screen; stack the panels on phones */
.km-row > * { min-width: 0; }
@media only screen and (max-width: 767px) {
	.km-row { flex-wrap: wrap; }
	.km-row > .km-panel { flex-basis: 100% !important; }
}
@media only screen and (max-width: 767px) {
	/* Rows of buttons wrap cleanly instead of overlapping */
	.span10 p:has(> .btn) { display: flex; flex-wrap: wrap; gap: 6px; }
	.span10 p:has(> .btn) > .btn { margin: 0; }
	/* Settings uses two half columns: stack them full width */
	body > div.container-fluid > div.row-fluid > div.span5 { width: 100%; margin-left: 0; float: none; }
}
