:root {
  --iw-navy-900: #0b1f3a;
  --iw-navy-800: #0f2744;
  --iw-navy-700: #102a4c;
  --iw-navy-600: #123b86;
  --iw-blue-700: #0f3b82;
  --iw-blue-600: #1a56db;
  --iw-blue-500: #1d4ed8;
  --iw-blue-400: #2563eb;
  --iw-blue-200: #60a5fa;
  --iw-blue-25: #eff6ff;
  --iw-text: #0f172a;
  --iw-muted: #64748b;
  --iw-border: #dde3ed;
  --iw-border-strong: #cbd5e1;
  --iw-bg: #eef2f7;
  --iw-bg-soft: #f8fafd;
  --iw-surface: #fff;
  --iw-success: #15803d;
  --iw-success-bg: #dcfce7;
  --iw-warning: #a16207;
  --iw-warning-bg: #fef3c7;
  --iw-danger: #b91c1c;
  --iw-danger-bg: #fee2e2;
  --iw-info: #0369a1;
  --iw-info-bg: #e0f2fe;
  --iw-radius-sm: 6px;
  --iw-radius-md: 9px;
  --iw-radius-lg: 12px;
  --iw-radius-xl: 16px;
  --iw-shadow-card: 0 1px 3px rgba(15, 39, 68, .06), 0 8px 24px rgba(15, 39, 68, .08);
  --iw-shadow-pop: 0 20px 50px rgba(15, 23, 42, .22);
  --iw-sidebar-width: 248px;
  --iw-ease: .18s ease;
  --iw-font-ui: "Segoe UI", Tahoma, Arial, sans-serif;
  --iw-font-mono: Consolas, "SFMono-Regular", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { color: var(--iw-text); background: var(--iw-bg); font-family: var(--iw-font-ui); }
button, input, select, textarea { font: inherit; }
a, button, input, select, textarea, [tabindex]:not([tabindex="-1"]) { -webkit-tap-highlight-color: rgba(37, 99, 235, .15); }
:focus-visible { outline: 3px solid rgba(37, 99, 235, .38) !important; outline-offset: 2px; }

/* Legacy Bootstrap adapters */
body #page-content { background: var(--iw-bg); min-height: 100vh; }
body #wrap { padding-bottom: 24px; }
body #page-content > #wrap > .container { width: 100%; max-width: 1440px; padding-left: 24px; padding-right: 24px; }
body .page-title-box { padding: 24px 2px 16px; }
body .page-title-box h1 { color: var(--iw-navy-800); font-size: clamp(22px, 2vw, 28px); line-height: 1.2; }
body .page-title-box .subtitle { color: var(--iw-muted); font-size: 14px; line-height: 1.55; }
body .card-pro, body .pb-shell { border-color: var(--iw-border); border-radius: var(--iw-radius-xl); box-shadow: var(--iw-shadow-card); }

body .btn, body .btn-act {
  min-height: 44px;
  border-radius: var(--iw-radius-md) !important;
  padding: 10px 16px;
  font-weight: 650 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  line-height: 1.15;
  white-space: normal;
}
body .btn-xs, body .btn-sm { min-height: 40px; font-size: 13px; padding: 8px 13px; }
body .btn-primary { background: var(--iw-blue-600); border-color: var(--iw-blue-600); }
body .btn-primary:hover, body .btn-primary:focus { background: var(--iw-blue-700); border-color: var(--iw-blue-700); }
body .btn-success { background: var(--iw-success); border-color: var(--iw-success); }
body .btn-default { color: var(--iw-text); border-color: var(--iw-border-strong); background: #fff; }
body .btn[disabled], body .btn.disabled { opacity: .58; cursor: not-allowed; }

body .form-control {
  min-height: 44px;
  border-color: var(--iw-border-strong);
  border-radius: var(--iw-radius-md);
  box-shadow: none;
  color: var(--iw-text);
  font-size: 16px;
}
body .form-control:focus { border-color: var(--iw-blue-400); box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }
body label { color: #334155; font-weight: 650; }
body .table-responsive { -webkit-overflow-scrolling: touch; }
body .table > thead > tr > th { color: var(--iw-navy-800); background: #f1f5f9; border-bottom-width: 1px; }
body .table > tbody > tr > td { vertical-align: middle; }

/* Application shell */
body .navbar.navbar-fixed-top {
  min-height: 56px;
  background: linear-gradient(100deg, #0f2744 0%, #153f6b 58%, #1d4f82 100%);
  border: 0;
  border-bottom: 1px solid rgba(147, 197, 253, .28);
  box-shadow: 0 3px 12px rgba(15, 39, 68, .22);
}
body #page-leftbar { width: var(--iw-sidebar-width); background: var(--iw-navy-900); }
body #page-content { margin-left: var(--iw-sidebar-width); }
body footer { margin-left: var(--iw-sidebar-width); }
#leftmenu-trigger.iw-menu-trigger {
  width: 44px;
  height: 44px;
  margin: 6px 0 0 10px;
  border: 0;
  border-radius: var(--iw-radius-md);
  background: rgba(255, 255, 255, .12);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
}
.iw-sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, .48); z-index: 1035; }
.iw-network-state {
  position: fixed;
  right: 14px;
  top: 11px;
  z-index: 1041;
  min-height: 34px;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--iw-success-bg);
  color: #166534;
  border: 1px solid #86efac;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.iw-network-state.is-offline { background: var(--iw-danger-bg); color: var(--iw-danger); border-color: #fca5a5; }
.iw-sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

/* Modal and feedback */
body .modal-content { border: 0; border-radius: var(--iw-radius-xl); box-shadow: var(--iw-shadow-pop); overflow: hidden; }
body .modal-header { background: var(--iw-navy-800); color: #fff; }
body .modal-footer { background: var(--iw-bg-soft); border-color: var(--iw-border); }
body .modal-footer .btn { min-width: 96px; }
body .bootbox .modal-dialog { max-width: 520px; }
body .empty-box { border-color: var(--iw-border-strong); border-radius: var(--iw-radius-lg); color: var(--iw-muted); }

/* Planning touch planner */
.iw-touch-help { display: none; }
.iw-planning-dock {
  display: none;
  position: fixed;
  left: calc(var(--iw-sidebar-width) + 18px);
  right: 18px;
  bottom: 18px;
  z-index: 1032;
  background: #fff;
  border: 1px solid var(--iw-border);
  border-radius: var(--iw-radius-xl);
  box-shadow: var(--iw-shadow-pop);
  padding: 16px;
}
.iw-planning-dock.is-open { display: block; }
.iw-planning-dock__top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 13px; }
.iw-planning-dock__title { flex: 1; min-width: 0; }
.iw-planning-dock__title strong { display: block; color: var(--iw-navy-800); font-family: var(--iw-font-mono); }
.iw-planning-dock__title span { display: block; color: var(--iw-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iw-planning-dock__close { width: 44px; height: 44px; border: 1px solid var(--iw-border); border-radius: 50%; background: #fff; }
.iw-planning-dock__fields { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) auto; gap: 10px; align-items: end; }
.iw-planning-dock__field label { display: block; margin-bottom: 5px; font-size: 12px; }
.iw-planning-dock__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.iw-planning-dock__scheduled { display: none; gap: 8px; flex-wrap: wrap; }
.iw-planning-dock.is-scheduled .iw-planning-dock__fields { display: none; }
.iw-planning-dock.is-scheduled .iw-planning-dock__scheduled { display: flex; }
.job-card.is-selected, .job-block.is-selected { box-shadow: 0 0 0 3px rgba(37, 99, 235, .38) !important; border-color: var(--iw-blue-400) !important; }

@media (max-width: 1180px) {
  body #page-content > #wrap > .container { padding-left: 18px; padding-right: 18px; }
}

@media (max-width: 1024px) {
  body { padding-top: 56px; }
  body #page-leftbar {
    position: fixed !important;
    z-index: 1040;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(328px, 86vw) !important;
    transform: translateX(-105%);
    transition: transform var(--iw-ease);
    box-shadow: 16px 0 40px rgba(15, 23, 42, .28);
    overflow-y: auto;
  }
  body.iw-sidebar-open { overflow: hidden; }
  body.iw-sidebar-open #page-leftbar { transform: translateX(0); }
  body.iw-sidebar-open .iw-sidebar-overlay { display: block; }
  body #page-content, body footer { margin-left: 0 !important; }
  #leftmenu-trigger.iw-menu-trigger { display: inline-flex; }
  .iw-network-state { right: 10px; }
  body #page-content > #wrap > .container { max-width: none; padding-left: 16px; padding-right: 16px; }
  body .page-title-box { padding-top: 18px; }
  body .btn, body .btn-sm, body .btn-xs, body .btn-act { min-height: 48px; padding: 10px 15px; }
  body .pb-actions .btn { min-height: 48px; }
  body .pb-date-input { min-height: 48px !important; height: 48px !important; width: 170px !important; }
  body .pb-head { align-items: stretch; }
  body .pb-head .pb-title { width: 100%; }
  body .pb-head .sp { display: none; }
  body .pb-actions { width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  body .pb-actions .btn { width: 100%; }
  body .pb-legend .leg:last-child { display: none; }
  .iw-touch-help { display: inline-flex; align-items: center; gap: 6px; color: var(--iw-blue-700); font-weight: 650; }
  body .job-card, body .job-block { cursor: pointer; touch-action: manipulation; }
  .iw-planning-dock { left: 16px; right: 16px; bottom: 16px; }
}

@media (max-width: 767px) {
  body #page-content > #wrap > .container { padding-left: 10px; padding-right: 10px; }
  body .page-title-box { padding: 14px 2px 11px; }
  body .page-title-box h1 { font-size: 21px; align-items: flex-start; }
  body .page-title-box h1 i { width: 40px; height: 40px; flex: 0 0 40px; }
  body .card-pro, body .pb-shell { border-radius: var(--iw-radius-lg); }
  body .pb-head { padding: 12px; }
  body .pb-clock { min-height: 44px; display: inline-flex; align-items: center; }
  body .pb-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body .pb-actions .btn { min-height: 52px; }
  body .pb-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; padding: 10px; gap: 8px; }
  body .kcard { min-width: 0; padding: 10px; }
  body .kicon { display: none; }
  body .pool-list { scroll-snap-type: x proximity; padding: 10px; }
  body .job-card { scroll-snap-align: start; min-width: min(80vw, 280px) !important; }
  body .board-tools { align-items: stretch; }
  body .board-tools > strong { width: 100%; }
  body .board-tools select { width: calc(50% - 5px) !important; min-width: 0; }
  body .board-tools .btn { flex: 1; }
  .iw-planning-dock { left: 8px; right: 8px; bottom: 8px; padding: 14px; max-height: calc(100vh - 72px); overflow-y: auto; }
  .iw-planning-dock__fields { grid-template-columns: 1fr 1fr; }
  .iw-planning-dock__actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
  .iw-planning-dock__actions .btn, .iw-planning-dock__scheduled .btn { min-height: 52px; flex: 1 1 calc(50% - 8px); }

  body .search-group { width: 100%; display: grid; grid-template-columns: 1fr auto auto; }
  body .search-group .form-control { min-width: 0; width: 100%; }
  body .filter-row, body .page-actions, body .card-pro-header { align-items: stretch; }
  body .card-pro-header { gap: 10px; }
  body .card-pro-header .btn { width: 100%; }
  body .modal-dialog { margin: 0; width: 100%; min-height: 100%; }
  body .modal-content { min-height: 100vh; border-radius: 0; }
  body .modal-body { padding: 16px; }
  body .modal-footer { position: sticky; bottom: 0; z-index: 2; display: grid; grid-template-columns: 1fr 1fr; }
  body .modal-footer .btn { width: 100%; min-height: 52px; margin: 0 !important; }

  /* Card-list transformation; labels are supplied by iwis-responsive.js. */
  body .iw-card-table-wrap, body .tbl-wrap { border: 0; overflow: visible; background: transparent; }
  body .table-pro, body .tbl-wrap table { min-width: 0 !important; border: 0; background: transparent; }
  body .table-pro thead, body .tbl-wrap table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  body .table-pro tbody, body .table-pro tr, body .table-pro td,
  body .tbl-wrap table tbody, body .tbl-wrap table tr, body .tbl-wrap table td { display: block; width: 100%; }
  body .table-pro tr, body .tbl-wrap table tr { margin-bottom: 10px; padding: 10px 12px; background: #fff; border: 1px solid var(--iw-border); border-radius: var(--iw-radius-lg); box-shadow: 0 2px 8px rgba(15,39,68,.05); }
  body .table-pro td, body .tbl-wrap table td { border: 0 !important; border-bottom: 1px solid #edf2f7 !important; padding: 9px 0 !important; text-align: right !important; min-height: 38px; }
  body .table-pro td:last-child, body .tbl-wrap table td:last-child { border-bottom: 0 !important; }
  body .table-pro td::before, body .tbl-wrap table td::before { content: attr(data-label); float: left; max-width: 45%; padding-right: 12px; text-align: left; color: var(--iw-muted); font-weight: 700; }
  body .table-pro td .btn { min-height: 44px; }
  body .step-guide { gap: 8px; }
  body .dropzone { min-height: 190px; display: flex; flex-direction: column; justify-content: center; }
  body .act-bar { position: sticky; bottom: 8px; z-index: 10; background: rgba(255,255,255,.96); padding: 10px; border: 1px solid var(--iw-border); border-radius: var(--iw-radius-lg); box-shadow: var(--iw-shadow-card); }
  body .act-bar .btn-act { width: 100%; min-height: 52px; margin: 4px 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
  .iw-network-state, .iw-sidebar-overlay, #leftmenu-trigger, .iw-planning-dock { display: none !important; }
}
