/* =========================================================================
   App-wide refresh: sidebar, top bar, page titles, widgets, tables, forms,
   buttons, labels, tabs, dropdowns, popups and the login page.

   Loaded on every page by layouts/main.php and active only while <html> has
   .ui-refresh (?ui=classic turns it off). Every selector is wrapped in
   :where(html.ui-refresh) so it has the same specificity as the theme rule it
   replaces: it beats application.css by load order, but any page's own
   <style> block (loaded later, in the body) still wins.
   ========================================================================= */

/* ---------- Base ---------- */
:where(html.ui-refresh) body { background-color: var(--dr-bg); color: var(--dr-ink-2); font-family: var(--dr-font); -webkit-font-smoothing: antialiased; }
:where(html.ui-refresh) h1, :where(html.ui-refresh) h2, :where(html.ui-refresh) h3,
:where(html.ui-refresh) h4, :where(html.ui-refresh) h5, :where(html.ui-refresh) h6 { font-family: var(--dr-font); color: var(--dr-ink); }
:where(html.ui-refresh) a { color: #c47400; transition: color 150ms ease; }
:where(html.ui-refresh) a:hover, :where(html.ui-refresh) a:focus { color: var(--dr-ink); }
:where(html.ui-refresh) ::selection { background: rgba(255, 165, 0, .28); }
:where(html.ui-refresh) .text-muted { color: var(--dr-muted); }
/* layouts/main.php forces every <p> into "Continental", which only has the Light face registered.
   Use the Book weight for app text, but keep slide content (what goes into the PDF) untouched. */
html.ui-refresh p { font-family: var(--dr-font) !important; }
html.ui-refresh #sortable p, html.ui-refresh [slide_name] p, html.ui-refresh .slides p,
html.ui-refresh .note-editor p, html.ui-refresh .note-editable p { font-family: 'Continental' !important; }

/* Opaque: on small screens the content slides over the sidebar */
:where(html.ui-refresh) .content-wrap, :where(html.ui-refresh) .content { background-color: var(--dr-bg); }
@media (max-width: 767px) {
    :where(html.ui-refresh) main#content.content { padding: 68px 16px 24px; }
}

/* A short fade-in when a page opens (the dashboard and wizards have their own entrance) */
:where(html.ui-refresh) body:not(.dash-refresh):not(.wiz-refresh):not(.login-page) main#content { animation: uiPageIn 360ms var(--dr-ease) both; }
@keyframes uiPageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Page title & breadcrumb ---------- */
:where(html.ui-refresh) .page-title { margin: 4px 0 24px; font-size: 32px; font-weight: 500; letter-spacing: -.01em; line-height: 1.2; color: var(--dr-ink); }
:where(html.ui-refresh) .page-title small { font-size: 55%; color: var(--dr-muted); font-weight: 400; }
:where(html.ui-refresh) .page-title .fw-semi-bold { font-weight: 500; }
:where(html.ui-refresh) .page-title .fa { color: var(--dr-accent-mark); font-size: .8em; margin-right: 4px; }
:where(html.ui-refresh) .breadcrumb { margin: 0 0 6px; padding: 0; background: transparent; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--dr-muted); }
:where(html.ui-refresh) .breadcrumb > li + li:before { content: "\00b7"; padding: 0 8px; color: var(--dr-muted); }
:where(html.ui-refresh) .breadcrumb > .active { color: var(--dr-ink); }

/* ---------- Sidebar ---------- */
:where(html.ui-refresh) .sidebar { background-color: #141416; }
:where(html.ui-refresh) .sidebar .logo { border-bottom: 1px solid rgba(255, 255, 255, .06); }
:where(html.ui-refresh) .sidebar-nav { padding: 8px 0; }
:where(html.ui-refresh) .sidebar-nav > li > a {
    margin: 2px 10px; padding-left: 46px; border: 0; border-radius: 10px; line-height: 40px;
    color: #a9abb3; font-size: 14px; letter-spacing: .01em;
    transition: background-color 150ms ease, color 150ms ease;
}
:where(html.ui-refresh) .sidebar-nav > li:last-child > a { border-bottom: 0; }
:where(html.ui-refresh) .sidebar-nav > li > a .icon { top: 6px; left: 8px; }
:where(html.ui-refresh) .sidebar-nav > li > a .icon .fa,
:where(html.ui-refresh) .sidebar-nav > li > a .icon .glyphicon { color: #7d7f87; font-size: 15px; transition: color 150ms ease; }
:where(html.ui-refresh) .sidebar-nav > li > a:hover { background-color: rgba(255, 255, 255, .06); color: #fff; }
:where(html.ui-refresh) .sidebar-nav > li > a:hover .icon .fa,
:where(html.ui-refresh) .sidebar-nav > li > a:hover .icon .glyphicon { color: #d6d7dc; }
:where(html.ui-refresh) .sidebar-nav > .active > a { background-color: rgba(255, 165, 0, .12); color: #ffb22e; }
:where(html.ui-refresh) .sidebar-nav > .active > a .icon { background-color: var(--dr-accent); border-radius: 8px; }
:where(html.ui-refresh) .sidebar-nav > .active > a .icon .fa,
:where(html.ui-refresh) .sidebar-nav > .active > a .icon .glyphicon { color: var(--dr-ink); }

/* ---------- Top bar ---------- */
:where(html.ui-refresh) .page-controls { background: rgba(255, 255, 255, .92); -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px); border: 0; border-bottom: 1px solid var(--dr-line); box-shadow: none; }
:where(html.ui-refresh) .page-controls .navbar-nav > li > a { color: var(--dr-ink); font-weight: 500; font-size: 14px; border-radius: 10px; transition: background-color 150ms ease, color 150ms ease; }
:where(html.ui-refresh) .page-controls .navbar-nav > li > a:hover,
:where(html.ui-refresh) .page-controls .navbar-nav > .open > a { background-color: #f1f0ec; color: var(--dr-ink); }

/* ---------- Dropdowns ---------- */
:where(html.ui-refresh) .dropdown-menu {
    padding: 6px; border: 1px solid var(--dr-line); border-radius: 12px; box-shadow: var(--dr-shadow-hover);
    font-size: 14px; transform-origin: top right;
}
:where(html.ui-refresh) .open > .dropdown-menu { animation: uiMenuIn 160ms var(--dr-ease); }
:where(html.ui-refresh) .dropdown-menu > li > a { padding: 8px 12px; border-radius: 8px; color: var(--dr-ink); transition: background-color 120ms ease; }
:where(html.ui-refresh) .dropdown-menu > li > a:hover, :where(html.ui-refresh) .dropdown-menu > li > a:focus { background-color: #f3f2ee; color: var(--dr-ink); }
:where(html.ui-refresh) .dropdown-menu > .active > a, :where(html.ui-refresh) .dropdown-menu > .active > a:hover { background-color: var(--dr-accent-soft); color: var(--dr-warn); }
:where(html.ui-refresh) .dropdown-menu .divider { margin: 6px 4px; background-color: var(--dr-line); }
@keyframes uiMenuIn { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Widgets (cards) ---------- */
:where(html.ui-refresh) .widget {
    background: var(--dr-surface); border-radius: var(--dr-radius); border: 1px solid rgba(22, 22, 26, .04);
    box-shadow: var(--dr-shadow); padding: 20px 22px;
}
:where(html.ui-refresh) .widget > header h1, :where(html.ui-refresh) .widget > header h2, :where(html.ui-refresh) .widget > header h3,
:where(html.ui-refresh) .widget > header h4, :where(html.ui-refresh) .widget > header h5 { font-weight: 400; color: var(--dr-ink); }
:where(html.ui-refresh) .widget > header .fw-semi-bold, :where(html.ui-refresh) .widget > header strong { font-weight: 500; }
:where(html.ui-refresh) .widget-controls a { color: var(--dr-muted); border-radius: 8px; transition: background-color 150ms ease, color 150ms ease; }
:where(html.ui-refresh) .widget-controls a:hover { background-color: #f1f0ec; color: var(--dr-ink); }
:where(html.ui-refresh) legend { color: var(--dr-ink); border-bottom-color: var(--dr-line); font-family: var(--dr-font); }
:where(html.ui-refresh) hr { border-top-color: var(--dr-line); }
:where(html.ui-refresh) .thumbnail { border-radius: 12px; border-color: var(--dr-line); transition: box-shadow 200ms ease, border-color 200ms ease; }
:where(html.ui-refresh) .well { background-color: var(--dr-surface-2); border-color: var(--dr-line); border-radius: 12px; box-shadow: none; }

/* ---------- Tables ---------- */
:where(html.ui-refresh) .table > thead > tr > th {
    border-bottom: 1px solid var(--dr-line); border-top: 0; padding: 10px 12px; vertical-align: bottom;
    font-size: 12px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--dr-muted);
}
:where(html.ui-refresh) .table > tbody > tr > td, :where(html.ui-refresh) .table > tbody > tr > th { border-top: 1px solid var(--dr-line); padding: 11px 12px; vertical-align: middle; color: var(--dr-ink); }
:where(html.ui-refresh) .table > tbody > tr { transition: background-color 150ms ease; }
:where(html.ui-refresh) .table-hover > tbody > tr:hover { background-color: var(--dr-surface-2); }
:where(html.ui-refresh) .table-striped > tbody > tr:nth-of-type(odd) { background-color: #fbfbf9; }
:where(html.ui-refresh) .table-bordered, :where(html.ui-refresh) .table-bordered > thead > tr > th, :where(html.ui-refresh) .table-bordered > tbody > tr > td { border-color: var(--dr-line); }

/* Yii grids (CGridView): header links, filter row, summary, pager */
:where(html.ui-refresh) .grid-view > table { border: 0; border-collapse: separate; border-spacing: 0; width: 100%; }
:where(html.ui-refresh) .grid-view > table th {
    background: transparent; color: var(--dr-muted); border: 0; border-bottom: 1px solid var(--dr-line); padding: 10px 12px; text-align: left;
    font-size: 12px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase;
}
:where(html.ui-refresh) .grid-view > table th a { color: var(--dr-ink-2); text-decoration: none; }
:where(html.ui-refresh) .grid-view > table th a:hover { color: var(--dr-ink); }
:where(html.ui-refresh) .grid-view > table th a.asc, :where(html.ui-refresh) .grid-view > table th a.desc { color: var(--dr-ink); background-position: right center; padding-right: 14px; }
:where(html.ui-refresh) .grid-view > table tr.even, :where(html.ui-refresh) .grid-view > table tr.odd { background: transparent; }
:where(html.ui-refresh) .grid-view > table tr.selected { background: var(--dr-accent-soft); }
:where(html.ui-refresh) .grid-view > table td { font-size: 14px; padding: 11px 12px; border-top: 1px solid var(--dr-line); color: var(--dr-ink); }
:where(html.ui-refresh) .grid-view > table tr:hover td { background: var(--dr-surface-2); }
:where(html.ui-refresh) .grid-view > table tr.filters td { padding: 8px 6px 12px; border-top: 0; background: transparent; }
:where(html.ui-refresh) .grid-view > table tr.filters input,
:where(html.ui-refresh) .grid-view > table tr.filters select {
    width: 100%; height: 34px; padding: 0 10px; border: 1px solid #e3e1db; border-radius: 8px; background: var(--dr-surface-2);
    font-size: 13px; color: var(--dr-ink); transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}
:where(html.ui-refresh) .grid-view > table tr.filters input:focus,
:where(html.ui-refresh) .grid-view > table tr.filters select:focus { outline: 0; border-color: var(--dr-accent-mark); background: #fff; box-shadow: 0 0 0 3px rgba(255, 165, 0, .18); }
:where(html.ui-refresh) .grid-view .summary { color: var(--dr-muted); font-size: 12px; margin: 0 0 10px; }
:where(html.ui-refresh) .grid-view .empty { color: var(--dr-muted); font-style: normal; }
:where(html.ui-refresh) .grid-view .button-column a { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; transition: background-color 150ms ease; }
:where(html.ui-refresh) .grid-view .button-column a:hover { background: #f1f0ec; }
:where(html.ui-refresh) .grid-view-loading { background-position: right 10px center; }
:where(html.ui-refresh) .pager { margin: 16px 0 0; text-align: right; }
:where(html.ui-refresh) .grid-view .pager .header { color: var(--dr-muted); font-size: 13px; margin-right: 6px; }
:where(html.ui-refresh) ul.yiiPager { display: inline-flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; border: 0; }
:where(html.ui-refresh) ul.yiiPager li { display: inline-block; }
:where(html.ui-refresh) ul.yiiPager li a {
    display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 10px;
    border: 1px solid var(--dr-line); border-radius: 10px; background: var(--dr-surface); color: var(--dr-ink); font-weight: 400; font-size: 13px; text-decoration: none;
    transition: background-color 150ms ease, border-color 150ms ease, transform 160ms var(--dr-ease);
}
:where(html.ui-refresh) ul.yiiPager li a:hover { background: #f1f0ec; border-color: #dedcd5; }
:where(html.ui-refresh) ul.yiiPager li a:active { transform: scale(.95); }
:where(html.ui-refresh) ul.yiiPager .selected a { background: var(--dr-accent); border-color: var(--dr-accent); color: var(--dr-ink); font-weight: 500; }
:where(html.ui-refresh) ul.yiiPager .hidden a { opacity: .4; pointer-events: none; }
:where(html.ui-refresh) .pagination > li > a, :where(html.ui-refresh) .pagination > li > span { border-color: var(--dr-line); color: var(--dr-ink); margin: 0 2px; border-radius: 10px; }
:where(html.ui-refresh) .pagination > .active > a, :where(html.ui-refresh) .pagination > .active > a:hover { background-color: var(--dr-accent); border-color: var(--dr-accent); color: var(--dr-ink); }

/* ---------- Forms ---------- */
:where(html.ui-refresh) .form-control {
    border: 1px solid #e3e1db; border-radius: var(--dr-radius-sm); background-color: var(--dr-surface); box-shadow: none; color: var(--dr-ink);
    font-family: var(--dr-font); transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}
:where(html.ui-refresh) .form-control:hover { border-color: #d3d1ca; }
:where(html.ui-refresh) .form-control:focus { border-color: var(--dr-accent-mark); box-shadow: 0 0 0 4px rgba(255, 165, 0, .18); outline: 0; }
:where(html.ui-refresh) .form-control[disabled], :where(html.ui-refresh) .form-control[readonly], :where(html.ui-refresh) fieldset[disabled] .form-control { background-color: var(--dr-bg); border-color: transparent; color: var(--dr-ink-2); opacity: 1; }
:where(html.ui-refresh) .form-control::placeholder { color: #a9aab0; }
:where(html.ui-refresh) .input-group-addon { border-color: #e3e1db; background-color: var(--dr-surface-2); color: var(--dr-ink-2); }
:where(html.ui-refresh) .input-group .form-control:first-child, :where(html.ui-refresh) .input-group-addon:first-child { border-radius: var(--dr-radius-sm) 0 0 var(--dr-radius-sm); }
:where(html.ui-refresh) .input-group .form-control:last-child, :where(html.ui-refresh) .input-group-addon:last-child { border-radius: 0 var(--dr-radius-sm) var(--dr-radius-sm) 0; }
:where(html.ui-refresh) label, :where(html.ui-refresh) .control-label { color: #000; font-weight: 500; font-family: var(--dr-font); }
/* Checkbox / radio option text (e.g. the tire filters); the theme only styles the box itself */
:where(html.ui-refresh) .checkbox label, :where(html.ui-refresh) .radio label,
:where(html.ui-refresh) .checkbox-inline, :where(html.ui-refresh) .radio-inline { color: #000; }
:where(html.ui-refresh) .help-block, :where(html.ui-refresh) .hint { color: var(--dr-muted); font-size: 12px; }
:where(html.ui-refresh) .errorMessage, :where(html.ui-refresh) .help-block.error { color: var(--dr-danger); font-size: 12px; }
:where(html.ui-refresh) .error input, :where(html.ui-refresh) .error select, :where(html.ui-refresh) .error textarea,
:where(html.ui-refresh) input.error, :where(html.ui-refresh) select.error, :where(html.ui-refresh) textarea.error { border-color: #f0b7b2; background-color: #fdf3f2; }
:where(html.ui-refresh) .errorSummary { border: 1px solid #f5c4c0; background: #fdecea; color: var(--dr-danger); border-radius: 12px; padding: 12px 16px; }
:where(html.ui-refresh) .bootstrap-select > .btn { border: 1px solid #e3e1db; border-radius: var(--dr-radius-sm); background: var(--dr-surface); box-shadow: none; color: var(--dr-ink); }
:where(html.ui-refresh) .bootstrap-select > .btn:focus, :where(html.ui-refresh) .bootstrap-select.open > .btn { border-color: var(--dr-accent-mark); box-shadow: 0 0 0 4px rgba(255, 165, 0, .18); outline: 0 !important; }
:where(html.ui-refresh) input[type="checkbox"], :where(html.ui-refresh) input[type="radio"] { accent-color: var(--dr-accent-mark); }

/* ---------- Buttons ---------- */
:where(html.ui-refresh) .btn {
    border-radius: var(--dr-radius-sm); font-family: var(--dr-font); font-weight: 500; text-shadow: none; box-shadow: none;
    transition: transform 160ms var(--dr-ease), background-color 200ms ease, border-color 200ms ease, color 200ms ease, box-shadow 200ms ease;
}
:where(html.ui-refresh) .btn:active, :where(html.ui-refresh) .btn.active { transform: scale(.97); box-shadow: none; }
:where(html.ui-refresh) .btn:focus-visible { outline: 2px solid var(--dr-ink); outline-offset: 2px; }
:where(html.ui-refresh) .btn-rounded { border-radius: 999px; }
:where(html.ui-refresh) .btn-default { background-color: var(--dr-surface); border-color: #e3e1db; color: var(--dr-ink); }
:where(html.ui-refresh) .btn-info { background-color: var(--dr-accent); border-color: var(--dr-accent); color: var(--dr-ink); }
:where(html.ui-refresh) .btn-primary, :where(html.ui-refresh) .btn-inverse, :where(html.ui-refresh) .btn-gray { background-color: var(--dr-ink); border-color: var(--dr-ink); color: #fff; }
:where(html.ui-refresh) .btn-warning { background-color: var(--dr-accent-soft); border-color: #ffd58a; color: #7a4f00; }
:where(html.ui-refresh) .btn-success { background-color: var(--dr-good); border-color: var(--dr-good); color: #fff; }
:where(html.ui-refresh) .btn-danger { background-color: var(--dr-danger); border-color: var(--dr-danger); color: #fff; }
:where(html.ui-refresh) .btn-link { color: #c47400; }
@media (hover: hover) and (pointer: fine) {
    :where(html.ui-refresh) .btn-default:hover { background-color: var(--dr-surface-2); border-color: #d3d1ca; color: var(--dr-ink); }
    :where(html.ui-refresh) .btn-info:hover { background-color: #ffb22e; border-color: #ffb22e; color: var(--dr-ink); }
    :where(html.ui-refresh) .btn-primary:hover, :where(html.ui-refresh) .btn-inverse:hover, :where(html.ui-refresh) .btn-gray:hover { background-color: #2a2a30; border-color: #2a2a30; color: #fff; }
    :where(html.ui-refresh) .btn-warning:hover { background-color: #ffe9bf; border-color: #ffc864; color: #7a4f00; }
    :where(html.ui-refresh) .btn-success:hover { background-color: #1c6f41; border-color: #1c6f41; color: #fff; }
    :where(html.ui-refresh) .btn-danger:hover { background-color: #a72a23; border-color: #a72a23; color: #fff; }
}
:where(html.ui-refresh) .btn-info:focus, :where(html.ui-refresh) .btn-info:active:focus { background-color: #ffb22e; border-color: #ffb22e; color: var(--dr-ink); }
:where(html.ui-refresh) .btn-primary:focus, :where(html.ui-refresh) .btn-primary:active:focus { background-color: #2a2a30; border-color: #2a2a30; color: #fff; }
:where(html.ui-refresh) .btn.disabled, :where(html.ui-refresh) .btn[disabled] { opacity: .5; transform: none; }
/* Disabled buttons keep their own color, just faded (the theme turns them blue/gray) */
:where(html.ui-refresh) .btn-default.disabled, :where(html.ui-refresh) .btn-default.disabled:hover, :where(html.ui-refresh) .btn-default.disabled:focus, :where(html.ui-refresh) .btn-default.disabled:active, :where(html.ui-refresh) .btn-default[disabled], :where(html.ui-refresh) .btn-default[disabled]:hover, :where(html.ui-refresh) .btn-default[disabled]:focus, :where(html.ui-refresh) .btn-default[disabled]:active { background-color: var(--dr-surface); border-color: #e3e1db; color: var(--dr-ink); }
:where(html.ui-refresh) .btn-info.disabled, :where(html.ui-refresh) .btn-info.disabled:hover, :where(html.ui-refresh) .btn-info.disabled:focus, :where(html.ui-refresh) .btn-info.disabled:active, :where(html.ui-refresh) .btn-info[disabled], :where(html.ui-refresh) .btn-info[disabled]:hover, :where(html.ui-refresh) .btn-info[disabled]:focus, :where(html.ui-refresh) .btn-info[disabled]:active { background-color: var(--dr-accent); border-color: var(--dr-accent); color: var(--dr-ink); }
:where(html.ui-refresh) .btn-primary.disabled, :where(html.ui-refresh) .btn-primary.disabled:hover, :where(html.ui-refresh) .btn-primary.disabled:focus, :where(html.ui-refresh) .btn-primary.disabled:active, :where(html.ui-refresh) .btn-primary[disabled], :where(html.ui-refresh) .btn-primary[disabled]:hover, :where(html.ui-refresh) .btn-primary[disabled]:focus, :where(html.ui-refresh) .btn-primary[disabled]:active { background-color: var(--dr-ink); border-color: var(--dr-ink); color: #fff; }
:where(html.ui-refresh) .btn-inverse.disabled, :where(html.ui-refresh) .btn-inverse.disabled:hover, :where(html.ui-refresh) .btn-inverse.disabled:focus, :where(html.ui-refresh) .btn-inverse.disabled:active, :where(html.ui-refresh) .btn-inverse[disabled], :where(html.ui-refresh) .btn-inverse[disabled]:hover, :where(html.ui-refresh) .btn-inverse[disabled]:focus, :where(html.ui-refresh) .btn-inverse[disabled]:active { background-color: var(--dr-ink); border-color: var(--dr-ink); color: #fff; }
:where(html.ui-refresh) .btn-gray.disabled, :where(html.ui-refresh) .btn-gray.disabled:hover, :where(html.ui-refresh) .btn-gray.disabled:focus, :where(html.ui-refresh) .btn-gray.disabled:active, :where(html.ui-refresh) .btn-gray[disabled], :where(html.ui-refresh) .btn-gray[disabled]:hover, :where(html.ui-refresh) .btn-gray[disabled]:focus, :where(html.ui-refresh) .btn-gray[disabled]:active { background-color: var(--dr-ink); border-color: var(--dr-ink); color: #fff; }
:where(html.ui-refresh) .btn-warning.disabled, :where(html.ui-refresh) .btn-warning.disabled:hover, :where(html.ui-refresh) .btn-warning.disabled:focus, :where(html.ui-refresh) .btn-warning.disabled:active, :where(html.ui-refresh) .btn-warning[disabled], :where(html.ui-refresh) .btn-warning[disabled]:hover, :where(html.ui-refresh) .btn-warning[disabled]:focus, :where(html.ui-refresh) .btn-warning[disabled]:active { background-color: var(--dr-accent-soft); border-color: #ffd58a; color: #7a4f00; }
:where(html.ui-refresh) .btn-success.disabled, :where(html.ui-refresh) .btn-success.disabled:hover, :where(html.ui-refresh) .btn-success.disabled:focus, :where(html.ui-refresh) .btn-success.disabled:active, :where(html.ui-refresh) .btn-success[disabled], :where(html.ui-refresh) .btn-success[disabled]:hover, :where(html.ui-refresh) .btn-success[disabled]:focus, :where(html.ui-refresh) .btn-success[disabled]:active { background-color: var(--dr-good); border-color: var(--dr-good); color: #fff; }
:where(html.ui-refresh) .btn-danger.disabled, :where(html.ui-refresh) .btn-danger.disabled:hover, :where(html.ui-refresh) .btn-danger.disabled:focus, :where(html.ui-refresh) .btn-danger.disabled:active, :where(html.ui-refresh) .btn-danger[disabled], :where(html.ui-refresh) .btn-danger[disabled]:hover, :where(html.ui-refresh) .btn-danger[disabled]:focus, :where(html.ui-refresh) .btn-danger[disabled]:active { background-color: var(--dr-danger); border-color: var(--dr-danger); color: #fff; }

/* ---------- Labels, badges, alerts, progress ---------- */
:where(html.ui-refresh) .label { display: inline-block; padding: 4px 10px; border-radius: 999px; font-weight: 500; font-size: 11px; letter-spacing: .02em; }
:where(html.ui-refresh) .label-default { background-color: #eeeef1; color: var(--dr-ink-2); }
:where(html.ui-refresh) .label-success { background-color: var(--dr-good-soft); color: var(--dr-good); }
:where(html.ui-refresh) .label-warning { background-color: var(--dr-warn-soft); color: var(--dr-warn); }
:where(html.ui-refresh) .label-danger { background-color: #fdecea; color: var(--dr-danger); }
:where(html.ui-refresh) .label-info, :where(html.ui-refresh) .label-primary { background-color: #eaf0fb; color: #2d5aa8; }
:where(html.ui-refresh) .badge { border-radius: 999px; background-color: var(--dr-ink); font-weight: 500; }
:where(html.ui-refresh) .alert { border-radius: 12px; border: 1px solid transparent; }
:where(html.ui-refresh) .alert-success { background-color: var(--dr-good-soft); border-color: #bfe2cc; color: #1c6f41; }
:where(html.ui-refresh) .alert-warning { background-color: var(--dr-warn-soft); border-color: #ffe0a8; color: var(--dr-warn); }
:where(html.ui-refresh) .alert-danger { background-color: #fdecea; border-color: #f5c4c0; color: #a72a23; }
:where(html.ui-refresh) .alert-info { background-color: #eef3fb; border-color: #cfdcf3; color: #2d5aa8; }
:where(html.ui-refresh) .progress { background-color: var(--dr-track); border-radius: 999px; box-shadow: none; }
:where(html.ui-refresh) .progress-bar { background-color: var(--dr-accent-mark); box-shadow: none; transition: width 500ms var(--dr-ease); }

/* ---------- Tabs & pills ---------- */
:where(html.ui-refresh) .nav-tabs { border-bottom: 1px solid var(--dr-line); background-color: transparent; border-radius: 0; }
:where(html.ui-refresh) .nav-tabs > li > a { border: 0; border-radius: 0; margin-right: 4px; padding: 10px 14px; color: var(--dr-muted); background: transparent; box-shadow: inset 0 -2px 0 transparent; transition: color 150ms ease, box-shadow 200ms ease; }
:where(html.ui-refresh) .nav-tabs > li > a:hover { background: transparent; color: var(--dr-ink); box-shadow: inset 0 -2px 0 #dedcd5; }
:where(html.ui-refresh) .nav-tabs > li.active > a, :where(html.ui-refresh) .nav-tabs > li.active > a:hover, :where(html.ui-refresh) .nav-tabs > li.active > a:focus { border: 0; background: transparent; color: var(--dr-ink); font-weight: 500; box-shadow: inset 0 -2px 0 var(--dr-accent-mark); }
:where(html.ui-refresh) .tab-content { background-color: transparent; }
:where(html.ui-refresh) .nav-pills > li > a { border-radius: 999px; color: var(--dr-ink-2); transition: background-color 150ms ease, color 150ms ease; }
:where(html.ui-refresh) .nav-pills > li.active > a, :where(html.ui-refresh) .nav-pills > li.active > a:hover { background-color: var(--dr-ink); color: #fff; }
/* Older wizards (ContiYard, ContiPressure) still use pills for their steps */
:where(html.ui-refresh) .form-wizard .nav-pills > li > a { background-color: var(--dr-surface); color: var(--dr-muted); border: 1px solid var(--dr-line); border-radius: 999px; }
:where(html.ui-refresh) .form-wizard .nav-pills > li.done > a { background-color: #eeeef1; color: var(--dr-ink-2); }
:where(html.ui-refresh) .form-wizard .nav-pills > li.active > a { background-color: var(--dr-accent) !important; border-color: var(--dr-accent); color: var(--dr-ink); }

/* ---------- Popups (fancybox, Bootstrap modals) ---------- */
:where(html.ui-refresh) .fancybox-skin { border-radius: var(--dr-radius) !important; box-shadow: 0 30px 80px -20px rgba(22, 22, 26, .45) !important; overflow: hidden; }
:where(html.ui-refresh) .fancybox-overlay { background: rgba(22, 22, 26, .45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
:where(html.ui-refresh) .fancybox-opened { animation: uiPopIn 220ms var(--dr-ease); }
:where(html.ui-refresh) .error_header { font-family: var(--dr-font); font-weight: 500; }
:where(html.ui-refresh) .modal-content { border: 0; border-radius: var(--dr-radius); box-shadow: 0 30px 80px -20px rgba(22, 22, 26, .45); }
:where(html.ui-refresh) .modal-header { border-bottom-color: var(--dr-line); }
:where(html.ui-refresh) .modal-footer { border-top-color: var(--dr-line); }
:where(html.ui-refresh) .modal-backdrop.in { opacity: .45; }
:where(html.ui-refresh) .modal.fade .modal-dialog { transform: translateY(8px) scale(.98); transition: transform 220ms var(--dr-ease); }
:where(html.ui-refresh) .modal.in .modal-dialog { transform: none; }
:where(html.ui-refresh) .tooltip-inner { border-radius: 8px; padding: 6px 10px; background-color: var(--dr-ink); font-family: var(--dr-font); }
:where(html.ui-refresh) .popover { border-radius: 12px; border-color: var(--dr-line); box-shadow: var(--dr-shadow-hover); }
@keyframes uiPopIn { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }

/* ---------- Footer ---------- */
:where(html.ui-refresh) .content footer { color: var(--dr-muted); font-size: 12px; }

/* ---------- Login ---------- */
:where(html.ui-refresh) body.login-page, :where(html.ui-refresh) body.login-page > .container { background: #141416 radial-gradient(1200px 600px at 50% -10%, rgba(255, 165, 0, .14), transparent 60%) !important; min-height: 100vh; }
:where(html.ui-refresh) .widget-login {
    border-radius: 20px; border: 1px solid rgba(255, 255, 255, .06); padding: 28px 30px;
    box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .6);
}
:where(html.ui-refresh) .widget-login .form-control { height: 44px; }
:where(html.ui-refresh) .widget-login .form > form > .row { margin-bottom: 14px; }
:where(html.ui-refresh) .widget-login .btn-gray, :where(html.ui-refresh) .widget-login input[type="submit"] {
    width: 100%; height: 46px; border-radius: 999px; background-color: var(--dr-accent); border-color: var(--dr-accent); color: var(--dr-ink); font-size: 15px;
}
@media (hover: hover) and (pointer: fine) {
    :where(html.ui-refresh) .widget-login .btn-gray:hover, :where(html.ui-refresh) .widget-login input[type="submit"]:hover { background-color: #ffb22e; border-color: #ffb22e; color: var(--dr-ink); }
}

/* ---------- Zoom / narrow widths ----------
   At 125-175% browser zoom a 1920px screen behaves like 1100-1500px, so Bootstrap's narrow
   columns get too small for their buttons and wide grids outgrow their card. */
:where(html.ui-refresh) .widget .btn { white-space: normal; max-width: 100%; }
/* Toolbar rows (a row of small cards that each hold one button, e.g. Manage Tires): instead of fixed
   Bootstrap widths that squeeze the labels, each card fits its button, cards in a row share one height,
   and they wrap to the next line when space runs out. */
:where(html.ui-refresh) .row:has(> [class*="col-"] > .widget > .btn:only-child) { display: flex; flex-wrap: wrap; }
:where(html.ui-refresh) .row:has(> [class*="col-"] > .widget > .btn:only-child)::before,
:where(html.ui-refresh) .row:has(> [class*="col-"] > .widget > .btn:only-child)::after { display: none; }
:where(html.ui-refresh) .row:has(> [class*="col-"] > .widget > .btn:only-child) > [class*="col-"] { float: none; width: auto; flex: 1 1 auto; max-width: 50%; }
:where(html.ui-refresh) .row:has(> [class*="col-"] > .widget > .btn:only-child) > [class*="col-"] > .widget { height: calc(100% - 24px); margin-bottom: 24px; }
:where(html.ui-refresh) .widget:has(> .btn:only-child) { display: flex; align-items: center; padding: 14px; }
:where(html.ui-refresh) .widget:has(> .btn:only-child) > .btn { white-space: nowrap; }
:where(html.ui-refresh) .grid-view { overflow-x: auto; -webkit-overflow-scrolling: touch; }
:where(html.ui-refresh) .grid-view > table td .btn { white-space: nowrap; }
:where(html.ui-refresh) .ui-nowrap { white-space: nowrap; }
@media (min-width: 768px) and (max-width: 1599px) {
    :where(html.ui-refresh) .content { padding-left: 24px; padding-right: 24px; }
    :where(html.ui-refresh) .grid-view > table td .btn { padding: 5px 9px; }
}
@media (max-width: 1599px) {
    :where(html.ui-refresh) .table > thead > tr > th, :where(html.ui-refresh) .table > tbody > tr > td,
    :where(html.ui-refresh) .grid-view > table th, :where(html.ui-refresh) .grid-view > table td { padding: 9px 8px; }
}
@media (max-width: 1279px) {
    :where(html.ui-refresh) .table > thead > tr > th, :where(html.ui-refresh) .table > tbody > tr > td,
    :where(html.ui-refresh) .grid-view > table th, :where(html.ui-refresh) .grid-view > table td { padding: 8px 6px; font-size: 13px; }
    :where(html.ui-refresh) .page-title { font-size: 28px; }
}

/* ---------- DataTables (Reports) ----------
   application.css points DataTables sort headers and search inputs at images that don't exist
   (404s in the console). DataTables draws its own sort arrows; the search box gets an inline icon. */
html.ui-refresh table.dataTable thead .sorting,
html.ui-refresh table.dataTable thead .sorting_asc,
html.ui-refresh table.dataTable thead .sorting_desc { background-image: none; }
html.ui-refresh input.search, html.ui-refresh input[type=search] {
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2362646b' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 10px center;
    padding-left: 32px;
}

/* ---------- Grids that don't fit (tablets, phones, zoomed-in screens) ----------
   When a grid's table is wider than its card, js/app-refresh.js adds .ui-stack and each row becomes
   a small card: column name on the left, value on the right, row buttons together at the bottom.
   The script also copies each header into the cells' data-label and marks button / empty cells.
   Grids that fit stay as normal tables; without JS a wide grid scrolls inside its card. */
:where(html.ui-refresh) .grid-view.ui-stack { overflow-x: visible; }
:where(html.ui-refresh) .grid-view.ui-stack > table,
:where(html.ui-refresh) .grid-view.ui-stack > table > tbody,
:where(html.ui-refresh) .grid-view.ui-stack > table > tbody > tr { display: block; width: 100%; }
:where(html.ui-refresh) .grid-view.ui-stack > table > thead { display: none; }
:where(html.ui-refresh) .grid-view.ui-stack > table > tbody > tr {
        margin: 0 0 12px; padding: 10px 14px; border: 1px solid var(--dr-line); border-radius: 12px; background: var(--dr-surface);
    }
:where(html.ui-refresh) .grid-view.ui-stack > table > tbody > tr:nth-of-type(odd) { background: var(--dr-surface); }
:where(html.ui-refresh) .grid-view.ui-stack > table > tbody > tr > td {
        display: flex; justify-content: flex-end; align-items: baseline; gap: 0;
        padding: 7px 0; border: 0; border-bottom: 1px solid var(--dr-line); text-align: right; font-size: 14px; word-break: break-word;
    }
:where(html.ui-refresh) .grid-view.ui-stack > table > tbody > tr > td::before {
        content: attr(data-label); flex: 0 0 auto; max-width: 45%; margin-right: auto; padding-right: 16px; text-align: left;
        font-size: 12px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--dr-muted);
    }
:where(html.ui-refresh) .grid-view.ui-stack > table > tbody > tr > td.ui-empty { display: none; }
/* the theme hides Yii's default button column everywhere; keep it hidden in card rows too */
:where(html.ui-refresh) .grid-view.ui-stack > table > tbody > tr > td.button-column,
:where(html.ui-refresh) .grid-view.ui-stack > table > tbody > tr > td.button-column.ui-actions { display: none; }
/* several pieces of one value (e.g. date + time) stay together on the right */
:where(html.ui-refresh) .grid-view.ui-stack > table > tbody > tr > td > .ui-nowrap + .ui-nowrap { margin-left: .4em; }
:where(html.ui-refresh) .grid-view.ui-stack > table > tbody > tr > td.ui-actions { display: inline-flex; width: auto; border: 0; padding: 10px 8px 2px 0; }
:where(html.ui-refresh) .grid-view.ui-stack > table > tbody > tr > td.ui-actions::before { content: none; }
:where(html.ui-refresh) .grid-view.ui-stack > table > tbody > tr > td:not(.ui-actions):not(.ui-empty):last-of-type { border-bottom: 0; }
:where(html.ui-refresh) .grid-view.ui-stack > table > tbody > tr:hover td { background: transparent; }
:where(html.ui-refresh) .grid-view.ui-stack > table > tbody > tr > td.empty { display: block; text-align: center; border: 0; }
:where(html.ui-refresh) .grid-view.ui-stack > table > tbody > tr > td.empty::before { content: none; }
:where(html.ui-refresh) .grid-view.ui-stack .summary { text-align: left; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    :where(html.ui-refresh) main#content, :where(html.ui-refresh) .open > .dropdown-menu, :where(html.ui-refresh) .fancybox-opened { animation: none !important; }
    :where(html.ui-refresh) .btn:active, :where(html.ui-refresh) .btn.active, :where(html.ui-refresh) ul.yiiPager li a:active { transform: none; }
    :where(html.ui-refresh) .modal.fade .modal-dialog { transform: none; transition: none; }
}

/* Quick Reference tire selection: 3 cards per row, and size dropdowns that never grow the card */
.tire_recommendations, .tire_recommendations #saved_tires {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: stretch;
}
.tire_recommendations::before, .tire_recommendations::after,
.tire_recommendations #saved_tires::before, .tire_recommendations #saved_tires::after { display: none; }
.tire_recommendations #saved_tires { grid-column: 1 / -1; margin: 0; padding: 0; list-style: none; }
.tire_recommendations .loader, .tire_recommendations > .col-sm-12, .tire_recommendations > hr { grid-column: 1 / -1; }
.tire_recommendations > hr { display: none; }
.tire_recommendations .gallery-item { float: none; width: auto; min-width: 0; margin: 0; padding: 0; }
.tire_recommendations .gallery-item .thumbnail { height: 100%; margin: 0; }
.tire_recommendations .bootstrap-select { width: 100% !important; }
.tire_recommendations .bootstrap-select > .btn { height: 40px; overflow: hidden; padding-right: 32px; }
.tire_recommendations .bootstrap-select > .btn .filter-option {
    float: none !important; display: block; width: 100%; text-align: left;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (max-width: 991px) {
    .tire_recommendations, .tire_recommendations #saved_tires { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 575px) {
    .tire_recommendations, .tire_recommendations #saved_tires { grid-template-columns: minmax(0, 1fr); }
}
