/*
 * HAQQ on AdminLTE 3 — theme overrides plus styling for the legacy CI1 view markup
 * (table.tbl, tr.row, .inp, .titlex ...), so the 160+ old views render in AdminLTE style
 * without rewriting each one. Scoped to .haqq-legacy (the card body every page renders in).
 */

:root {
	--haqq-green: #1e7e45;
	--haqq-green-dark: #155d33;
	--haqq-green-soft: #eaf6ee;
	--haqq-border: #dee2e6;
}

/* ---- Brand / chrome ---------------------------------------------------- */
.haqq-logo, .brand-link .brand-image.haqq-logo {
	display: inline-flex; align-items: center; justify-content: center;
	width: 33px; height: 33px; max-height: none; line-height: 1; margin-top: 0;
	background: #fff; color: var(--haqq-green); border-radius: 50%;
	font-weight: 700; font-size: 1.1rem; opacity: 1 !important;
}
.main-sidebar.sidebar-dark-success { background: #173d2a; }
.sidebar-dark-success .nav-sidebar > .nav-item > .nav-link.active { background-color: var(--haqq-green); }
.nav-sidebar .nav-header { font-size: .72rem; letter-spacing: .06em; color: #9fc4ae !important; padding-top: .9rem; }
.haqq-company-badge { font-size: .8rem; padding: .45em .7em; }
.content-header h1:empty { display: none; }
.content-header { padding-bottom: .25rem; }

/* ---- Legacy layout helpers -------------------------------------------- */
/* Old views have fixed-width inputs/tables; scroll inside the card instead of widening the page. */
.haqq-legacy { overflow-x: auto; min-width: 0; max-width: 100%; }
.content-wrapper .card { min-width: 0; max-width: 100%; }
.haqq-legacy .clear { clear: both; }
.haqq-legacy .block { display: block; }
.haqq-legacy img { max-width: 100%; }
.haqq-legacy a:not(.btn) { color: var(--haqq-green); }
.haqq-legacy .txton { color: #04ae00; }
.haqq-legacy .txtoff, .haqq-legacy .warning { color: #dc3545; }
.haqq-legacy .on { color: #04ae00; }
.haqq-legacy .off { color: #dc3545; }

/* Page headings used by the old views */
.haqq-legacy h3, .haqq-legacy h3.title, .haqq-legacy h3.titlex {
	font-size: 1.15rem; font-weight: 600; color: #343a40;
	margin: 0 0 .75rem; padding: 0;
}

/* ---- Tables ------------------------------------------------------------ */
/* Bootstrap's .row is a flex grid; the old views put class="row" on <tr>. Keep them table rows. */
.haqq-legacy tr.row, .haqq-legacy tr.rowxx, table tr.row {
	display: table-row; margin: 0; flex-wrap: nowrap;
}
.haqq-legacy table.tbl, .haqq-legacy table.tblxx, .haqq-legacy table.tbl2 {
	width: 100%; margin-bottom: 1rem; border-collapse: collapse;
	background: #fff; border: 1px solid var(--haqq-border); font-size: .875rem;
}
.haqq-legacy table.tbl td, .haqq-legacy table.tbl th,
.haqq-legacy table.tblxx td, .haqq-legacy table.tbl2 td {
	padding: .45rem .6rem; border-top: 1px solid var(--haqq-border); vertical-align: middle;
}
/* first header row = table caption bar */
.haqq-legacy table.tbl > thead > tr:first-child > td,
.haqq-legacy table.tbl > thead > tr:first-child > th {
	background: var(--haqq-green); color: #fff; font-weight: 600;
	text-transform: uppercase; letter-spacing: .03em; font-size: .8rem; border-color: var(--haqq-green);
}
.haqq-legacy table.tbl > thead > tr:first-child > td a { color: #fff; text-decoration: underline; }
.haqq-legacy table.tbl tr.col-title td, .haqq-legacy table.tbl tr.col-title th, .haqq-legacy table.tbl tr.col-titlexx td,
.haqq-legacy table.tbl > thead > tr:not(:first-child) > td {
	background: #f4f6f9; color: #495057; font-weight: 600; border-bottom: 2px solid var(--haqq-border);
}
.haqq-legacy table.tbl tr.col-title td a { color: #495057; }
.haqq-legacy table.tbl tbody tr.r2 { background: #fafbfc; }
.haqq-legacy table.tbl tbody tr.row:hover, .haqq-legacy table.tbl tbody tr.r2:hover { background: var(--haqq-green-soft); }
.haqq-legacy table.tbl tbody tr.sub-title td { background: #d9efe1; color: var(--haqq-green-dark); font-weight: 600; }
.haqq-legacy table.tbl tbody tr.txt td { background: #fff; }
.haqq-legacy table.tbl_info, .haqq-legacy table.tbl_info2, .haqq-legacy table.tbl_info3 { font-size: .875rem; }
/* the legacy tables sometimes float side by side; stack them on small screens */
@media (max-width: 767.98px) {
	.haqq-legacy table.tbl[style*="float"] { float: none !important; width: 100% !important; }
	.haqq-legacy .haqq-scroll { overflow-x: auto; }
}

/* ---- Forms ------------------------------------------------------------- */
.haqq-legacy input[type=text], .haqq-legacy input[type=password], .haqq-legacy input[type=email],
.haqq-legacy input[type=number], .haqq-legacy input[type=date], .haqq-legacy input[type=file],
.haqq-legacy select, .haqq-legacy textarea, .haqq-legacy .inp {
	display: inline-block; max-width: 100%;
	padding: .25rem .5rem; font-size: .875rem; line-height: 1.5; color: #495057;
	background: #fff; border: 1px solid #ced4da; border-radius: .2rem;
	transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}
.haqq-legacy input[type=file] { border: 0; padding-left: 0; }
.haqq-legacy input:focus, .haqq-legacy select:focus, .haqq-legacy textarea:focus {
	outline: 0; border-color: #5dbb82; box-shadow: 0 0 0 .15rem rgba(40, 167, 69, .2);
}
.haqq-legacy input[readonly], .haqq-legacy input[disabled], .haqq-legacy select[disabled], .haqq-legacy textarea[readonly] {
	background: #e9ecef;
}

/* Buttons: every legacy submit/button looks like an AdminLTE button */
.haqq-legacy input[type=submit], .haqq-legacy input[type=button], .haqq-legacy input[type=reset],
.haqq-legacy button:not(.close):not(.btn), .haqq-legacy .small-btn, .haqq-legacy .print-btn, .haqq-legacy .submit {
	display: inline-block; font-weight: 400; text-align: center; vertical-align: middle; cursor: pointer;
	padding: .25rem .75rem; font-size: .875rem; line-height: 1.5; border-radius: .2rem;
	color: #fff; background-color: var(--haqq-green); border: 1px solid var(--haqq-green);
	transition: background-color .15s ease-in-out;
}
.haqq-legacy input[type=submit]:hover, .haqq-legacy input[type=button]:hover,
.haqq-legacy button:not(.close):not(.btn):hover, .haqq-legacy .small-btn:hover { background-color: var(--haqq-green-dark); }
.haqq-legacy input[type=reset], .haqq-legacy input[type=button][value=Back], .haqq-legacy input[type=button][value=Cancel],
.haqq-legacy input[type=button][value=Close] {
	color: #212529; background-color: #f8f9fa; border-color: #ced4da;
}
.haqq-legacy .small-btn { padding: .1rem .45rem; font-size: .75rem; }

/* "Create New" / "Print" action links that the listings put above the table */
.haqq-legacy .haqq-actions { margin-bottom: .75rem; }

/* ---- Messages ---------------------------------------------------------- */
#sys-msg { margin-bottom: 1rem; }
.haqq-legacy .msg_new {
	margin: .5rem 0; padding: .5rem .75rem; border-left: 4px solid #17a2b8; background: #e8f7fa; border-radius: .2rem;
}

/* ---- Dashboard ---------------------------------------------------------- */
.haqq-stats .small-box .icon > i { font-size: 60px; top: 15px; }
.haqq-stats .small-box h3 { font-size: 2rem; color: inherit; margin: 0 0 10px; font-weight: 700; }

/* ---- Login ------------------------------------------------------------- */
.login-page { background: linear-gradient(135deg, #173d2a 0%, #1e7e45 60%, #4fb477 100%); }
.login-logo a { color: #fff; }
.login-logo .haqq-logo { width: 48px; height: 48px; font-size: 1.6rem; border-radius: 50%; margin-right: .4rem; vertical-align: middle; }

/* dhtmlgoodies calendar popup above AdminLTE's fixed navbar */
#calendarDiv { z-index: 1100 !important; }

/* ---- Dashboard charts ---------------------------------------------------- */
.haqq-charts > [class*="col-"] { margin-bottom: 1rem; }
.haqq-charts .card-title { font-size: 1rem; font-weight: 600; }
.haqq-legacy .haqq-charts h3.card-title { margin: 0; }
.haqq-donut-wrap { position: relative; height: 210px; }
.haqq-donut-center {
	position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
	pointer-events: none; color: #212529; line-height: 1.1;
}
.haqq-donut-center strong { font-size: 1.9rem; font-weight: 700; }
.haqq-donut-center span { font-size: .8rem; color: #6c757d; }
.haqq-legend li { display: flex; align-items: center; padding: .2rem 0; font-size: .875rem; color: #212529; }
.haqq-legend-inline { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.haqq-legend-inline li { padding: 0; }
.haqq-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: .4rem; flex: none; }
.haqq-legend-icon { width: 1rem; color: #6c757d; margin-right: .35rem; font-size: .8rem; }
.haqq-legend-label { flex: 1; }
.haqq-legend-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.haqq-data summary { cursor: pointer; font-size: .8rem; color: #6c757d; }
.haqq-data table { font-size: .8rem; margin-top: .4rem; }
.haqq-swatch-hatch { background-image: repeating-linear-gradient(-45deg, transparent 0 2px, #9e2a2a 2px 3.5px); }

/* ---- Row action icons (delete/edit) — consistent across all listings ---- */
.haqq-del, .haqq-edit { cursor: pointer; font-size: 1rem; vertical-align: middle; }
.haqq-del { color: #dc3545; }
.haqq-del:hover { color: #a71d2a; }
.haqq-edit { color: var(--haqq-green); margin-right: .4rem; }
.haqq-edit:hover { color: var(--haqq-green-dark); }
