/* ==========================================================================
   LGU Mabinay — Admin Design System
   Modern, responsive government admin theme.

   Loaded LAST in webadmin/layouts/mainlayout.blade.php so it overrides the
   legacy template (dashboard.css / style.css). The legacy stylesheets are
   heavily specific and use !important in places, so a number of overrides
   here need !important to win. That is deliberate, not sloppiness.
   ========================================================================== */

:root {
	/* Brand — deep government green with a gold accent */
	--gov-primary: #0f5132;
	--gov-primary-600: #14663f;
	--gov-primary-700: #0c4128;
	--gov-primary-900: #082c1b;
	--gov-primary-050: #eaf3ee;
	--gov-accent: #f5a524;
	--gov-accent-600: #d98e12;

	/* Status */
	--gov-success: #15803d;
	--gov-success-bg: #e7f6ec;
	--gov-danger: #b42318;
	--gov-danger-bg: #fdecea;
	--gov-warning: #b54708;
	--gov-warning-bg: #fef3e2;
	--gov-info: #0b6bcb;
	--gov-info-bg: #e8f1fc;

	/* Neutrals */
	--gov-bg: #f5f7f9;
	--gov-surface: #ffffff;
	--gov-border: #e2e8f0;
	--gov-border-strong: #cbd5e1;
	--gov-text: #1e293b;
	--gov-text-muted: #64748b;

	/* Shape */
	--gov-radius: 10px;
	--gov-radius-sm: 7px;
	--gov-shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
	--gov-shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 12px rgba(15, 23, 42, .05);
	--gov-shadow-lg: 0 10px 30px rgba(15, 23, 42, .12);

	--gov-sidebar-w: 268px;
	--gov-header-h: 64px;

	--gov-font: "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
body {
	background-color: var(--gov-bg) !important;
	color: var(--gov-text);
	font-family: var(--gov-font);
	font-size: 14px;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
	font-family: var(--gov-font);
	color: var(--gov-text);
	font-weight: 600;
}

a { color: var(--gov-primary-600); }
a:hover { color: var(--gov-primary); text-decoration: none; }

/* Visible focus for keyboard users — the legacy theme removed it entirely. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
	outline: 2px solid var(--gov-accent);
	outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Header / top bar
   -------------------------------------------------------------------------- */
.ttr-header {
	background: var(--gov-surface) !important;
	height: var(--gov-header-h) !important;
	border-bottom: 1px solid var(--gov-border);
	box-shadow: var(--gov-shadow-sm) !important;
	z-index: 102;
}

.ttr-header .ttr-header-wrapper {
	display: flex;
	align-items: center;
	height: var(--gov-header-h);
	padding: 0 18px;
}

.ttr-header a,
.ttr-header .ttr-material-button {
	color: var(--gov-text) !important;
}

/* Brand block */
.ttr-header .ttr-logo-box {
	display: flex;
	align-items: center;
	height: var(--gov-header-h);
	width: auto;
	min-width: 0;
	padding-right: 16px;
}

.ttr-header .ttr-logo-box img {
	max-height: 40px;
	width: auto;
	object-fit: contain;
}

/* Sidebar toggle button — it is a real <button>, so reset the UA chrome. */
.ttr-header .ttr-toggle-sidebar {
	display: flex !important;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	margin-right: 10px;
	padding: 0;
	border: 0;
	background: transparent;
	border-radius: var(--gov-radius-sm);
	color: var(--gov-text) !important;
	font-size: 18px;
	cursor: pointer;
	transition: background-color .15s ease;
}

.ttr-header .ttr-toggle-sidebar:hover {
	background-color: var(--gov-primary-050);
	color: var(--gov-primary) !important;
}

.ttr-header-right {
	margin-left: auto;
	display: flex;
	align-items: center;
}

.ttr-header .ttr-user-avatar img {
	border-radius: 50%;
	border: 2px solid var(--gov-border);
	background: var(--gov-primary-050);
}

/* Account block in the top bar.

   The legacy theme lays these nav anchors out as table-cells, which beat a plain
   `.gov-account` selector — so the avatar, name and caret stacked VERTICALLY and
   the block grew to 94px inside a 64px header, spilling out of both edges. These
   selectors are deliberately specific enough to win. */
.ttr-header .ttr-header-right { float: none !important; }

.ttr-header .ttr-header-navigation {
	display: flex !important;
	align-items: center;
	height: var(--gov-header-h);
	margin: 0;
	padding: 0;
	list-style: none;
}

.ttr-header .ttr-header-navigation > li {
	display: flex !important;
	align-items: center;
	float: none !important;
	height: 100%;
	margin: 0;
	position: relative;
}

.ttr-header .ttr-header-navigation > li > a.gov-account,
a.gov-account {
	display: inline-flex !important;
	align-items: center;
	gap: 10px;
	height: auto !important;
	line-height: 1.2 !important;
	padding: 6px 10px !important;
	margin: 0 !important;
	border-radius: var(--gov-radius-sm);
	transition: background-color .15s ease;
}

.gov-account:hover { background-color: var(--gov-primary-050); }

.gov-account .ttr-user-avatar {
	display: flex !important;
	align-items: center;
	flex-shrink: 0;
	margin: 0 !important;
}

.gov-account .ttr-user-avatar img {
	display: block;
	width: 34px;
	height: 34px;
}

.gov-account__meta {
	display: flex;
	flex-direction: column;
	line-height: 1.25;
	text-align: left;
}

.gov-account__name {
	font-size: 13.5px;
	font-weight: 600;
	color: var(--gov-text);
}

.gov-account__role {
	font-size: 11.5px;
	color: var(--gov-text-muted);
}

.gov-account__caret {
	font-size: 10px;
	color: var(--gov-text-muted);
}

.ttr-header-submenu ul li a i { margin-right: 8px; }

/* On a phone the name/role would crowd out the logo. */
@media (max-width: 767px) {
	.gov-account__meta,
	.gov-account__caret { display: none; }
}

/* Account dropdown */
.ttr-header-submenu {
	border: 1px solid var(--gov-border);
	border-radius: var(--gov-radius);
	box-shadow: var(--gov-shadow-lg);
	overflow: hidden;
	padding: 6px;
}

.ttr-header-submenu ul li a {
	border-radius: var(--gov-radius-sm);
	padding: 9px 12px;
	font-weight: 500;
	color: var(--gov-text) !important;
}

.ttr-header-submenu ul li a:hover {
	background-color: var(--gov-primary-050);
	color: var(--gov-primary) !important;
}

/* The legacy search bar adds clutter without doing anything — hide it. */
.ttr-header .ttr-search-bar { display: none !important; }

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */
.ttr-sidebar {
	width: var(--gov-sidebar-w) !important;
	background: linear-gradient(180deg, var(--gov-primary) 0%, var(--gov-primary-900) 100%) !important;
	box-shadow: none !important;
	border-right: 1px solid rgba(255, 255, 255, .06);
	z-index: 103;
}

.ttr-sidebar-wrapper {
	padding-top: calc(var(--gov-header-h) + 14px);
	padding-bottom: 24px;
}

/* The template reserves a block for a sidebar logo we do not render — the brand
   lives in the top bar instead. Left in place it leaves a dead gap above the nav. */
.ttr-sidebar .ttr-sidebar-logo { display: none !important; }

.ttr-sidebar-navi ul {
	padding: 0 12px;
	margin: 0;
	list-style: none;
}

/* Section label above the nav */
.ttr-sidebar-navi::before {
	content: "Main Menu";
	display: block;
	padding: 0 26px 10px;
	font-size: 10.5px;
	font-weight: 700;
	letter-spacing: .09em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, .45);
}

.ttr-sidebar-navi ul li { margin-bottom: 2px; }

.ttr-sidebar-navi ul li a {
	display: flex !important;
	align-items: center;
	gap: 12px;
	padding: 11px 14px !important;
	border-radius: var(--gov-radius-sm);
	color: rgba(255, 255, 255, .78) !important;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.3;
	transition: background-color .15s ease, color .15s ease;
}

.ttr-sidebar-navi ul li a:hover {
	background-color: rgba(255, 255, 255, .1);
	color: #fff !important;
}

/* Active item: gold rail + lifted background */
.ttr-sidebar-navi ul li a.active {
	background-color: rgba(255, 255, 255, .14) !important;
	color: #fff !important;
	font-weight: 600;
	box-shadow: inset 3px 0 0 var(--gov-accent);
}

.ttr-sidebar-navi .ttr-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	font-size: 16px;
	flex-shrink: 0;
}

.ttr-sidebar-navi .ttr-label {
	margin: 0 !important;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ttr-sidebar-navi .ttr-seperate {
	height: 1px;
	background: rgba(255, 255, 255, .12);
	margin: 14px 8px;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */
.ttr-wrapper {
	padding-top: calc(var(--gov-header-h) + 24px) !important;
	padding-left: 24px;
	padding-right: 24px;
	padding-bottom: 40px;
}

.ttr-pinned-sidebar.ttr-opened-sidebar .ttr-wrapper {
	margin-left: var(--gov-sidebar-w);
}

/* Page heading + breadcrumb */
.db-breadcrumb {
	background: transparent;
	border: 0;
	padding: 0;
	margin-bottom: 20px;
}

.db-breadcrumb .breadcrumb-title {
	font-size: 22px;
	font-weight: 700;
	color: var(--gov-text);
	margin-bottom: 4px;
	letter-spacing: -.01em;
}

.db-breadcrumb-list {
	padding: 0;
	margin: 0;
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	font-size: 13px;
	color: var(--gov-text-muted);
}

.db-breadcrumb-list li { display: inline-flex; align-items: center; }
.db-breadcrumb-list li a { color: var(--gov-text-muted); }
.db-breadcrumb-list li a:hover { color: var(--gov-primary); }
.db-breadcrumb-list li a i { margin-right: 6px; }

.db-breadcrumb-list li + li::before {
	content: "/";
	margin: 0 8px;
	color: var(--gov-border-strong);
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.widget-box {
	background: var(--gov-surface);
	border: 1px solid var(--gov-border);
	border-radius: var(--gov-radius);
	box-shadow: var(--gov-shadow-sm);
	padding: 0;
	overflow: hidden;
}

.widget-box .wc-title {
	padding: 16px 20px;
	border-bottom: 1px solid var(--gov-border);
	background: #fbfcfd;
}

.widget-box .wc-title h4 {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	display: flex;
	align-items: center;
	gap: 8px;
}

.widget-box .wc-title h4 i { color: var(--gov-primary); }

.widget-box .wrapper,
.widget-box .email-wrapper { padding: 0; }

.widget-box .wrapper > .container,
.widget-box .wrapper > .container-fluid {
	width: 100%;
	max-width: none;
	padding: 20px;
}

.widget-box .mail-list-container { padding: 20px; }

/* --------------------------------------------------------------------------
   Dashboard: stat tiles + quick actions
   -------------------------------------------------------------------------- */
.gov-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
	gap: 16px;
	margin-bottom: 24px;
}

.gov-stat {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 18px;
	background: var(--gov-surface);
	border: 1px solid var(--gov-border);
	border-radius: var(--gov-radius);
	box-shadow: var(--gov-shadow-sm);
	transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.gov-stat:hover {
	border-color: var(--gov-primary);
	box-shadow: var(--gov-shadow);
	transform: translateY(-2px);
}

.gov-stat__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	border-radius: var(--gov-radius-sm);
	font-size: 19px;
	flex-shrink: 0;
}

.gov-stat__icon--green { background: var(--gov-primary-050); color: var(--gov-primary); }
.gov-stat__icon--gold  { background: #fdf3e0; color: var(--gov-accent-600); }
.gov-stat__icon--blue  { background: var(--gov-info-bg); color: var(--gov-info); }
.gov-stat__icon--slate { background: #eef2f6; color: #475569; }
.gov-stat__icon--plum  { background: #f3ecfa; color: #7c3aed; }
.gov-stat__icon--rose  { background: #fdeaf1; color: #be123c; }

.gov-stat__body {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.gov-stat__value {
	font-size: 24px;
	font-weight: 700;
	line-height: 1.15;
	color: var(--gov-text);
	letter-spacing: -.02em;
}

.gov-stat__label {
	font-size: 12.5px;
	color: var(--gov-text-muted);
	font-weight: 500;
}

.gov-quick {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.gov-quick__item {
	display: flex;
	align-items: center;
	gap: 11px;
	padding: 12px 14px;
	border: 1px solid var(--gov-border);
	border-radius: var(--gov-radius-sm);
	font-weight: 600;
	font-size: 13.5px;
	color: var(--gov-text) !important;
	background: #fff;
	transition: background-color .15s ease, border-color .15s ease;
}

.gov-quick__item i { color: var(--gov-primary); font-size: 15px; }

.gov-quick__item:hover {
	background: var(--gov-primary-050);
	border-color: var(--gov-primary);
	color: var(--gov-primary) !important;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
	border-radius: var(--gov-radius-sm) !important;
	font-family: var(--gov-font);
	font-weight: 600;
	font-size: 13.5px;
	padding: 9px 16px;
	border: 1px solid transparent;
	box-shadow: none;
	transition: background-color .15s ease, border-color .15s ease, transform .05s ease;
}

.btn:active { transform: translateY(1px); }

.btn.default-bg,
.btn.default-success,
.btn.bg-success {
	background-color: var(--gov-primary) !important;
	border-color: var(--gov-primary) !important;
	color: #fff !important;
}

.btn.default-bg:hover,
.btn.default-success:hover,
.btn.bg-success:hover {
	background-color: var(--gov-primary-600) !important;
	border-color: var(--gov-primary-600) !important;
	color: #fff !important;
}

.btn-secondary {
	background-color: #fff !important;
	border-color: var(--gov-border-strong) !important;
	color: var(--gov-text) !important;
}

.btn-secondary:hover {
	background-color: #f1f5f9 !important;
	color: var(--gov-text) !important;
}

/* Row action buttons (edit / delete / copy) */
.btn.button-sm {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0 !important;
	font-size: 13px;
	border-radius: var(--gov-radius-sm) !important;
	border: 1px solid var(--gov-border);
	background: #fff;
	line-height: 1;
	vertical-align: middle;
}

.btn.button-sm + .btn.button-sm { margin-left: 6px; }

.btn.button-sm.gray {
	color: var(--gov-text-muted) !important;
	background: #fff !important;
}

.btn.button-sm.gray:hover {
	background: var(--gov-primary-050) !important;
	border-color: var(--gov-primary);
	color: var(--gov-primary) !important;
}

.btn.button-sm.red {
	color: var(--gov-danger) !important;
	background: #fff !important;
	border-color: var(--gov-border);
}

.btn.button-sm.red:hover {
	background: var(--gov-danger-bg) !important;
	border-color: var(--gov-danger);
	color: var(--gov-danger) !important;
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
label {
	font-weight: 600;
	font-size: 13px;
	color: var(--gov-text);
	margin-bottom: 6px;
}

label small,
label .text-muted { font-weight: 400; }

.form-control {
	border: 1px solid var(--gov-border-strong) !important;
	border-radius: var(--gov-radius-sm) !important;
	padding: 10px 13px !important;
	height: auto !important;
	font-size: 14px;
	color: var(--gov-text);
	background-color: #fff !important;
	box-shadow: none !important;
	transition: border-color .15s ease, box-shadow .15s ease;
}

.form-control:focus {
	border-color: var(--gov-primary) !important;
	box-shadow: 0 0 0 3px rgba(15, 81, 50, .12) !important;
}

.form-control::placeholder { color: #9aa5b1; }

select.form-control { cursor: pointer; }

/* Form dropdowns are also taken over by bootstrap-select (functions.js applies it
   to every select on the page). Same wrapper/button double-frame problem: flatten
   the wrapper, and make the inner button look exactly like a .form-control so the
   Role / Storage / Category pickers match the text inputs beside them. */
.form-group .bootstrap-select.form-control,
.mail-compose .bootstrap-select.form-control {
	padding: 0 !important;
	border: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	height: auto !important;
	width: 100% !important;
}

.form-group .bootstrap-select > .dropdown-toggle,
.mail-compose .bootstrap-select > .dropdown-toggle {
	width: 100% !important;
	padding: 10px 30px 10px 13px !important;
	border: 1px solid var(--gov-border-strong) !important;
	border-radius: var(--gov-radius-sm) !important;
	background: #fff !important;
	color: var(--gov-text) !important;
	font-size: 14px;
	font-weight: 400;
	text-align: left;
	box-shadow: none !important;
	height: auto !important;
}

.form-group .bootstrap-select > .dropdown-toggle:focus,
.mail-compose .bootstrap-select > .dropdown-toggle:focus {
	border-color: var(--gov-primary) !important;
	box-shadow: 0 0 0 3px rgba(15, 81, 50, .12) !important;
	outline: none !important;
}

.bootstrap-select .dropdown-menu {
	border: 1px solid var(--gov-border);
	border-radius: var(--gov-radius-sm);
	box-shadow: var(--gov-shadow-lg);
	padding: 5px;
}

.bootstrap-select .dropdown-menu li a {
	border-radius: 5px;
	padding: 8px 11px;
	font-size: 14px;
}

.bootstrap-select .dropdown-menu li a:hover,
.bootstrap-select .dropdown-menu li.selected a {
	background: var(--gov-primary-050);
	color: var(--gov-primary);
}

input[type="file"].form-control {
	padding: 8px 13px !important;
	background: #fbfcfd !important;
}

/* --------------------------------------------------------------------------
   Alerts
   -------------------------------------------------------------------------- */
.alert {
	border-radius: var(--gov-radius);
	border: 1px solid transparent;
	padding: 13px 16px;
	font-size: 13.5px;
	font-weight: 500;
	margin-bottom: 18px;
}

.alert ul { padding-left: 18px; margin-bottom: 0; }

.alert-success {
	background-color: var(--gov-success-bg);
	border-color: rgba(21, 128, 61, .25);
	color: #14532d;
}

.alert-danger {
	background-color: var(--gov-danger-bg);
	border-color: rgba(180, 35, 24, .25);
	color: #7f1d1d;
}

/* --------------------------------------------------------------------------
   Badges
   -------------------------------------------------------------------------- */
.badge {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 4px 10px;
	border-radius: 999px;
	font-size: 11.5px;
	font-weight: 600;
	letter-spacing: .01em;
	text-transform: capitalize;
}

.badge-success {
	background-color: var(--gov-success-bg) !important;
	color: var(--gov-success) !important;
}

.badge-danger {
	background-color: var(--gov-danger-bg) !important;
	color: var(--gov-danger) !important;
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
/* Table header strip: page-level title + the primary action, above the table. */
.gov-table-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 4px;
}

.gov-table-head__title {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	color: var(--gov-text);
}

/* DataTables wraps the <table>, so its toolbar rows end up INSIDE this element.
   With a border and radius here, the Show/Search controls rendered in their own
   floating box above the table. Keep this purely as the horizontal scroll
   container and move the frame onto the table itself. */
.table-responsive {
	border: 0;
	border-radius: 0;
	background: transparent;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.table {
	margin-bottom: 0;
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	font-size: 13.5px;
	color: var(--gov-text);
	/* The frame lives here now, not on .table-responsive — see above. */
	border: 1px solid var(--gov-border) !important;
	border-radius: var(--gov-radius);
	overflow: hidden;
}

/* border-collapse: separate means the corners must be rounded per-cell. */
.table thead tr:first-child th:first-child { border-top-left-radius: var(--gov-radius); }
.table thead tr:first-child th:last-child { border-top-right-radius: var(--gov-radius); }
.table tbody tr:last-child td:first-child { border-bottom-left-radius: var(--gov-radius); }
.table tbody tr:last-child td:last-child { border-bottom-right-radius: var(--gov-radius); }

.table.table-bordered,
.table.table-bordered td,
.table.table-bordered th { border: 0 !important; }

.table thead th {
	background: #f8fafc;
	border-bottom: 1px solid var(--gov-border) !important;
	color: var(--gov-text-muted);
	font-weight: 600;
	font-size: 11.5px;
	letter-spacing: .04em;
	text-transform: uppercase;
	padding: 12px 14px;
	white-space: nowrap;
	vertical-align: middle;
}

.table tbody td {
	padding: 10px 14px;
	border-top: 1px solid var(--gov-border) !important;
	vertical-align: middle;
	line-height: 1.45;
}

.table tbody tr:first-child td { border-top: 0 !important; }

.table.table-hover tbody tr:hover { background-color: #f8fafc; }

.table tbody td a { font-weight: 500; }

/* Keep the action column from wrapping its buttons */
.table td:last-child { white-space: nowrap; }

/* --------------------------------------------------------------------------
   DataTables controls
   -------------------------------------------------------------------------- */
.dataTables_wrapper { padding: 0; }

.dataTables_wrapper .row:first-child {
	margin-bottom: 12px;
	margin-left: 0;
	margin-right: 0;
	align-items: center;
}

/* The stock Bootstrap-4 columns leave a wide dead gutter to the left of "Show".
   Flush them to the card edge and let the two controls sit at the ends. */
.dataTables_wrapper .row:first-child > [class*="col-"] { padding-left: 0; padding-right: 0; }

.dataTables_wrapper .dataTables_length { float: left; }
.dataTables_wrapper .dataTables_filter { float: right; text-align: right; }

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
	font-weight: 500;
	color: var(--gov-text-muted);
	font-size: 13px;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 0;
	white-space: nowrap;
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
	border: 1px solid var(--gov-border-strong);
	border-radius: var(--gov-radius-sm);
	padding: 7px 11px;
	font-size: 13.5px;
	color: var(--gov-text);
	background: #fff;
	outline: none;
	height: auto;
}

/* Just wide enough for "100" — the select is a page-size picker, not a field. */
.dataTables_wrapper .dataTables_length select {
	width: auto !important;
	min-width: 72px;
	padding-right: 26px;
}

.dataTables_wrapper .dataTables_filter input {
	width: 260px;
	max-width: 100%;
	margin-left: 0;
}

/* functions.js runs jQuery('select').selectpicker() over EVERY select on the page,
   so the DataTables page-size dropdown is swallowed by bootstrap-select and blown
   up to 424px wide — that was the huge empty "Show" box. Destroying the plugin
   instance removes the select entirely (no way to change page size), so instead
   size its control down to what a page-size picker actually needs. */
/* bootstrap-select copies .form-control onto its WRAPPER div, so the .form-control
   rules above drew a second box around the button's own box. Strip the wrapper
   back to a bare container and let the inner button carry the frame. Scoped to the
   table toolbar — the form selects below need to stay full width. */
.dataTables_length .bootstrap-select {
	width: auto !important;
	min-width: 78px;
	padding: 0 !important;
	border: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	height: auto !important;
}

.dataTables_length .bootstrap-select > .dropdown-toggle,
.dataTables_length .bootstrap-select > .btn {
	width: auto !important;
	min-width: 78px;
	padding: 7px 26px 7px 11px !important;
	border: 1px solid var(--gov-border-strong) !important;
	border-radius: var(--gov-radius-sm) !important;
	background: #fff !important;
	color: var(--gov-text) !important;
	font-size: 13.5px;
	font-weight: 500;
	box-shadow: none !important;
	text-align: left;
}

.dataTables_length .bootstrap-select > .dropdown-toggle:focus {
	border-color: var(--gov-primary) !important;
	box-shadow: 0 0 0 3px rgba(15, 81, 50, .12) !important;
	outline: none !important;
}

.dataTables_length .bootstrap-select .dropdown-menu {
	min-width: 78px;
	border: 1px solid var(--gov-border);
	border-radius: var(--gov-radius-sm);
	box-shadow: var(--gov-shadow-lg);
	padding: 5px;
	font-size: 13.5px;
}

.dataTables_length .bootstrap-select .dropdown-menu li a {
	border-radius: 5px;
	padding: 6px 10px;
}

.dataTables_length .bootstrap-select .dropdown-menu li a:hover,
.dataTables_length .bootstrap-select .dropdown-menu li.selected a {
	background: var(--gov-primary-050);
	color: var(--gov-primary);
}

.dataTables_wrapper .dataTables_length select:focus,
.dataTables_wrapper .dataTables_filter input:focus {
	border-color: var(--gov-primary);
	box-shadow: 0 0 0 3px rgba(15, 81, 50, .12);
}

.dataTables_wrapper .dataTables_info {
	color: var(--gov-text-muted);
	font-size: 13px;
	padding-top: 14px !important;
}

.dataTables_wrapper .dataTables_paginate { padding-top: 10px !important; }

.dataTables_wrapper .pagination { margin: 0; flex-wrap: wrap; }

.dataTables_wrapper .pagination .page-link {
	border: 1px solid var(--gov-border);
	color: var(--gov-text);
	margin-left: 4px;
	border-radius: var(--gov-radius-sm) !important;
	padding: 7px 12px;
	font-size: 13px;
	font-weight: 500;
	background: #fff;
}

.dataTables_wrapper .pagination .page-link:hover {
	background: var(--gov-primary-050);
	border-color: var(--gov-primary);
	color: var(--gov-primary);
}

.dataTables_wrapper .pagination .page-item.active .page-link {
	background: var(--gov-primary) !important;
	border-color: var(--gov-primary) !important;
	color: #fff !important;
}

.dataTables_wrapper .pagination .page-item.disabled .page-link {
	color: #b6c0cd;
	background: #fff;
}

/* DataTables export buttons */
.dt-buttons .btn {
	background: #fff !important;
	border: 1px solid var(--gov-border-strong) !important;
	color: var(--gov-text) !important;
	margin-right: 6px;
	padding: 8px 13px;
	font-size: 13px;
}

.dt-buttons .btn:hover {
	background: var(--gov-primary-050) !important;
	border-color: var(--gov-primary) !important;
	color: var(--gov-primary) !important;
}

/* --------------------------------------------------------------------------
   Summernote (rich text editor)
   -------------------------------------------------------------------------- */
.note-editor.note-frame {
	border: 1px solid var(--gov-border-strong);
	border-radius: var(--gov-radius-sm);
	overflow: hidden;
	box-shadow: none;
}

.note-editor.note-frame .note-toolbar {
	background: #f8fafc;
	border-bottom: 1px solid var(--gov-border);
	padding: 8px;
}

.note-editor.note-frame .note-statusbar { background: #f8fafc; }

/* --------------------------------------------------------------------------
   Gallery module
   -------------------------------------------------------------------------- */
.gov-admin-chip {
	display: inline-flex;
	align-items: center;
	margin-left: 8px;
	padding: 2px 9px;
	border-radius: 999px;
	background: var(--gov-primary-050);
	color: var(--gov-primary);
	font-size: 11.5px;
	font-weight: 600;
}

.gov-album {
	border: 1px solid var(--gov-border);
	border-radius: var(--gov-radius);
	margin-bottom: 18px;
	overflow: hidden;
}

.gov-album__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 13px 16px;
	background: #fbfcfd;
	border-bottom: 1px solid var(--gov-border);
}

.gov-album__name {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	color: var(--gov-text);
}

.gov-album__meta {
	font-size: 12.5px;
	color: var(--gov-text-muted);
}

.gov-album__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 12px;
	padding: 16px;
}

.gov-album__photo {
	position: relative;
	border-radius: var(--gov-radius-sm);
	overflow: hidden;
	border: 1px solid var(--gov-border);
	background: #f1f5f9;
	aspect-ratio: 4 / 3;
}

.gov-album__photo img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.gov-album__actions {
	position: absolute;
	top: 7px;
	right: 7px;
	display: flex;
	gap: 5px;
	opacity: 0;
	transform: translateY(-4px);
	transition: opacity .18s ease, transform .18s ease;
}

.gov-album__photo:hover .gov-album__actions,
.gov-album__photo:focus-within .gov-album__actions {
	opacity: 1;
	transform: none;
}

.gov-album__actions .btn.button-sm {
	width: 30px;
	height: 30px;
	box-shadow: var(--gov-shadow);
}

.gov-album__caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 14px 9px 7px;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, .72));
	color: #fff;
	font-size: 11.5px;
	font-weight: 600;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Touch devices have no hover — keep the actions reachable. */
@media (hover: none) {
	.gov-album__actions { opacity: 1; transform: none; }
}

/* Upload preview thumbnails */
.gov-preview {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
	gap: 10px;
	margin-top: 6px;
}

.gov-preview__note {
	grid-column: 1 / -1;
	margin: 0;
	font-size: 13px;
	font-weight: 600;
	color: var(--gov-primary);
}

.gov-preview__item {
	border-radius: var(--gov-radius-sm);
	overflow: hidden;
	border: 1px solid var(--gov-border);
	aspect-ratio: 1 / 1;
	background: #f1f5f9;
}

.gov-preview__item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.gov-edit-photo {
	border-radius: var(--gov-radius);
	overflow: hidden;
	border: 1px solid var(--gov-border);
	margin-bottom: 20px;
	background: #f1f5f9;
	max-height: 300px;
}

.gov-edit-photo img {
	width: 100%;
	height: 300px;
	object-fit: contain;
	display: block;
}

/* Empty state */
.gov-empty {
	text-align: center;
	padding: 48px 24px;
	border: 1px dashed var(--gov-border-strong);
	border-radius: var(--gov-radius);
	background: #fbfcfd;
}

.gov-empty i {
	display: block;
	font-size: 38px;
	color: var(--gov-primary);
	opacity: .3;
	margin-bottom: 12px;
}

.gov-empty h5 { margin-bottom: 6px; }

.gov-empty p {
	color: var(--gov-text-muted);
	margin-bottom: 16px;
	font-size: 14px;
}

/* --------------------------------------------------------------------------
   Flash toast
   -------------------------------------------------------------------------- */
.gov-toast {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 1080;
	display: flex;
	align-items: center;
	gap: 10px;
	max-width: min(420px, calc(100vw - 40px));
	padding: 13px 16px;
	border-radius: var(--gov-radius);
	background: var(--gov-surface);
	border: 1px solid var(--gov-border);
	box-shadow: var(--gov-shadow-lg);
	font-size: 13.5px;
	font-weight: 500;
	color: var(--gov-text);
	transition: opacity .25s ease, transform .25s ease;
}

.gov-toast--success { border-left: 4px solid var(--gov-success); }
.gov-toast--success i { color: var(--gov-success); }
.gov-toast--error { border-left: 4px solid var(--gov-danger); }
.gov-toast--error i { color: var(--gov-danger); }

.gov-toast span { flex: 1; }

.gov-toast__close {
	border: 0;
	background: transparent;
	color: var(--gov-text-muted);
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	padding: 0 2px;
}

.gov-toast__close:hover { color: var(--gov-text); }

.gov-toast--hidden {
	opacity: 0;
	transform: translateY(8px);
	pointer-events: none;
}

@media (max-width: 575px) {
	.gov-toast { right: 12px; left: 12px; bottom: 12px; max-width: none; }
}

/* --------------------------------------------------------------------------
   Mobile drawer overlay
   -------------------------------------------------------------------------- */
.ttr-overlay {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, .5);
	opacity: 0;
	visibility: hidden;
	z-index: 102;
	transition: opacity .2s ease, visibility .2s ease;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

/* Tablet: narrow the content gutters */
@media (max-width: 1199px) {
	.ttr-wrapper { padding-left: 18px; padding-right: 18px; }
}

/* Mobile / small tablet: sidebar becomes an off-canvas drawer.
   The content must never be pushed sideways, whatever classes the legacy
   template leaves on <body> — hence the !important on margin-left. */
@media (max-width: 991px) {
	.ttr-sidebar {
		left: 0 !important;
		transform: translateX(-100%);
		transition: transform .22s ease;
		width: 280px !important;
		box-shadow: var(--gov-shadow-lg) !important;
	}

	body.gov-drawer-open .ttr-sidebar { transform: translateX(0); }

	body.gov-drawer-open .ttr-overlay {
		opacity: 1;
		visibility: visible;
	}

	/* Stop the drawer's backdrop from scrolling the page behind it */
	body.gov-drawer-open { overflow: hidden; }

	.ttr-wrapper,
	.ttr-pinned-sidebar.ttr-opened-sidebar .ttr-wrapper {
		margin-left: 0 !important;
		padding-left: 14px;
		padding-right: 14px;
	}

	.ttr-header .ttr-logo-box img { max-height: 34px; }

	.db-breadcrumb .breadcrumb-title { font-size: 19px; }

	/* Filter/length controls stack instead of squashing */
	.dataTables_wrapper .dataTables_filter,
	.dataTables_wrapper .dataTables_length { float: none !important; text-align: left !important; }

	.dataTables_wrapper .dataTables_filter { margin-top: 10px; }

	/* The input lives inside the <label>, so the label has to stretch too. */
	.dataTables_wrapper .dataTables_filter label { display: flex; width: 100%; }
	.dataTables_wrapper .dataTables_filter input { width: 100% !important; min-width: 0; flex: 1; }

	.gov-table-head { margin-bottom: 10px; }
	.gov-table-head .btn { flex-shrink: 0; }

	.dataTables_wrapper .dataTables_paginate,
	.dataTables_wrapper .dataTables_info { float: none !important; text-align: left !important; }
}

@media (max-width: 575px) {
	.ttr-wrapper {
		padding-left: 12px;
		padding-right: 12px;
		padding-top: calc(var(--gov-header-h) + 16px) !important;
	}

	.widget-box .wrapper > .container,
	.widget-box .mail-list-container { padding: 14px; }

	.db-breadcrumb .breadcrumb-title { font-size: 18px; }

	/* Full-width primary actions read better on a phone */
	.btn.btn-lg,
	.btn.btn-block-mobile {
		display: block;
		width: 100%;
		float: none !important;
		margin-bottom: 8px;
	}

	.btn.button-sm { width: 36px; height: 36px; }
}
