:root {
  --itsm-primary: #2563eb;
  --itsm-primary-dark: #1d4ed8;
  --itsm-sidebar: #10213a;
  --itsm-sidebar-hover: #1c3556;
  --itsm-bg: #f3f6fb;
  --itsm-surface: #ffffff;
  --itsm-border: #e4eaf2;
  --itsm-text: #172033;
  --itsm-muted: #68758a;
  --itsm-radius: 14px;
  --itsm-shadow: 0 8px 24px rgba(31, 50, 81, .07);
}
* { box-sizing: border-box; }
html { background: var(--itsm-bg); }
body {
  margin: 0;
  color: var(--itsm-text);
  background: var(--itsm-bg);
  font-family: "Segoe UI", Tahoma, "Noto Sans Thai", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body > .d-flex { min-height: 100vh; align-items: stretch; }
.sidebar {
  position: sticky;
  top: 0;
  flex: 0 0 264px;
  width: 264px;
  height: 100vh;
  min-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 22px 16px !important;
  background: linear-gradient(180deg, #10213a 0%, #132a48 100%);
  border-right: 1px solid rgba(255,255,255,.06);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.2) transparent;
}
.sidebar h5 { font-size: 1.22rem; font-weight: 700; letter-spacing: -.02em; }
.sidebar .small { letter-spacing: .02em; }
.sidebar a,
.sidebar form .btn-link {
  display: flex !important;
  align-items: center;
  min-height: 42px;
  margin-bottom: 3px !important;
  padding: 9px 12px !important;
  border: 1px solid transparent;
  border-radius: 9px !important;
  color: #dce6f4 !important;
  font-weight: 500;
  transition: background-color .16s ease, color .16s ease, transform .16s ease;
}
.sidebar a:hover,
.sidebar form .btn-link:hover {
  color: #fff !important;
  background: rgba(255,255,255,.09) !important;
  transform: translateX(2px);
}
.sidebar a.active {
  color: #fff !important;
  background: var(--itsm-primary) !important;
  box-shadow: 0 6px 16px rgba(37,99,235,.28);
}
.sidebar .text-white-50 { color: #94a8c2 !important; }
.sidebar hr { opacity: .35; }
main.flex-grow-1 { min-width: 0; }
.navbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  min-height: 64px;
  padding: 0 28px !important;
  background: rgba(255,255,255,.96) !important;
  border-color: var(--itsm-border) !important;
  box-shadow: 0 1px 0 rgba(31,50,81,.03);
  backdrop-filter: blur(10px);
}
.navbar .fw-semibold { font-size: 1.02rem; }
.container-fluid.p-4 { max-width: 1680px; padding: 28px !important; margin-inline: auto; }
h1,h2,h3,h4,h5,h6 { color: #111c2f; font-weight: 650; letter-spacing: -.025em; }
h1 { font-size: clamp(1.8rem, 2.5vw, 2.35rem); }
h2 { font-size: clamp(1.55rem, 2vw, 2rem); }
h3 { font-size: 1.65rem; }
.small-muted, .text-muted { color: var(--itsm-muted) !important; }
.card {
  overflow: hidden;
  border: 1px solid rgba(228,234,242,.9) !important;
  border-radius: var(--itsm-radius) !important;
  background: var(--itsm-surface);
  box-shadow: var(--itsm-shadow) !important;
}
.card.p-3 { padding: 22px !important; }
.card.p-4 { padding: 26px !important; }
.row.g-3, .row.g-4 { --bs-gutter-y: 1.25rem; }
.btn {
  min-height: 40px;
  border-radius: 9px;
  padding: .48rem .9rem;
  font-weight: 600;
  box-shadow: none !important;
  transition: transform .15s ease, background-color .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--itsm-primary); border-color: var(--itsm-primary); }
.btn-primary:hover { background: var(--itsm-primary-dark); border-color: var(--itsm-primary-dark); }
.btn-sm { min-height: 32px; border-radius: 7px; padding: .25rem .6rem; }
.form-label, label { color: #29364a; font-weight: 500; }
.form-control, .form-select {
  min-height: 42px;
  border-color: #d8e0eb;
  border-radius: 9px;
  background-color: #fff;
  color: var(--itsm-text);
  box-shadow: none;
}
.form-control:focus, .form-select:focus {
  border-color: #7aa7f8;
  box-shadow: 0 0 0 .2rem rgba(37,99,235,.12);
}
textarea.form-control { min-height: 118px; }
.input-group > .form-control, .input-group > .form-select, .input-group > .btn { border-radius: 0; }
.input-group > :first-child { border-radius: 9px 0 0 9px; }
.input-group > :last-child { border-radius: 0 9px 9px 0; }
.table-responsive { border-radius: 10px; }
.table { margin-bottom: 0; color: var(--itsm-text); vertical-align: middle; }
.table > :not(caption) > * > * { padding: .78rem .72rem; border-bottom-color: #e7ecf3; }
.table thead th {
  color: #4a5870;
  background: #f8fafd;
  border-bottom-width: 1px;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .025em;
  text-transform: none;
  white-space: nowrap;
}
.table tbody tr { transition: background-color .12s ease; }
.table tbody tr:hover { background: #f8faff; }
.badge { border-radius: 999px; padding: .42em .68em; font-weight: 650; }
.alert { border: 1px solid transparent; border-radius: 11px; box-shadow: 0 5px 16px rgba(31,50,81,.05); }
.pagination { gap: 4px; }
.page-link {
  min-width: 38px;
  min-height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid #dfe6ef;
  border-radius: 8px !important;
  color: #315a9b;
}
.page-item.active .page-link { background: var(--itsm-primary); border-color: var(--itsm-primary); }
.modal-content { border: 0; border-radius: 16px; box-shadow: 0 24px 64px rgba(20,34,56,.2); }
.modal-header, .modal-footer { border-color: var(--itsm-border); }
.dropdown-menu { border: 1px solid var(--itsm-border); border-radius: 10px; box-shadow: var(--itsm-shadow); }
canvas { max-width: 100%; }
a { color: #1769e0; text-underline-offset: 2px; }
@media (max-width: 1100px) {
  .sidebar { flex-basis: 226px; width: 226px; }
  .container-fluid.p-4 { padding: 22px !important; }
  .card.p-3 { padding: 18px !important; }
}
@media (max-width: 760px) {
  body > .d-flex { display: block !important; }
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    min-height: auto;
    max-height: 46vh;
    padding: 16px !important;
  }
  .navbar { position: sticky; min-height: 58px; padding-inline: 16px !important; }
  .container-fluid.p-4 { padding: 16px !important; }
  .card.p-3, .card.p-4 { padding: 16px !important; }
  .table > :not(caption) > * > * { padding: .68rem .58rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
.login-page {
  position: relative;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 18%, rgba(59,130,246,.22), transparent 32%),
    radial-gradient(circle at 82% 82%, rgba(14,165,233,.14), transparent 30%),
    linear-gradient(145deg, #0d1d33 0%, #16365d 100%) !important;
}
.login-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 36px 36px;
}
.login-page .box { position: relative; z-index: 1; max-width: 430px; }
.login-page .card { border: 1px solid rgba(255,255,255,.2) !important; border-radius: 18px !important; box-shadow: 0 28px 72px rgba(2,12,27,.3) !important; }
.login-page .card-body { padding: clamp(28px, 6vw, 48px) !important; }
.login-page h3 { font-size: 1.75rem; }
.login-page .btn-lg { min-height: 48px; }
/* Viewport height density */
main.flex-grow-1 {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
main.flex-grow-1 > .container-fluid {
  width: 100%;
  flex: 1 1 auto;
}
.table > :not(caption) > * > * {
  height: auto;
  line-height: 1.35;
  vertical-align: middle;
}
.table td > :last-child { margin-bottom: 0; }
.sla-countdown { line-height: 1.2; white-space: nowrap; }

@media (max-height: 950px) and (min-width: 761px) {
  body { font-size: 14px; line-height: 1.42; }
  .sidebar { padding: 14px 10px !important; }
  .sidebar h5 { font-size: 1.1rem; }
  .sidebar a,
  .sidebar form .btn-link {
    min-height: 36px;
    margin-bottom: 1px !important;
    padding: 6px 10px !important;
  }
  .sidebar .text-white-50.small.mb-4 { margin-bottom: 1rem !important; }
  .sidebar .text-white-50.small.mt-3 { margin-top: .7rem !important; margin-bottom: .3rem !important; }
  .navbar { min-height: 56px; padding: 0 22px !important; }
  .container-fluid.p-4 { padding: 20px 22px !important; }
  .card.p-3 { padding: 16px !important; }
  .card.p-4 { padding: 20px !important; }
  .table > :not(caption) > * > * { padding: .55rem .62rem; }
  .btn { min-height: 36px; padding: .38rem .75rem; }
  .form-control, .form-select { min-height: 38px; }
  h3 { font-size: 1.5rem; }
}

@media (max-height: 760px) and (min-width: 761px) {
  body { font-size: 13.5px; line-height: 1.35; }
  .sidebar { padding: 10px 8px !important; }
  .sidebar a,
  .sidebar form .btn-link { min-height: 32px; padding: 4px 9px !important; }
  .navbar { min-height: 50px; }
  .container-fluid.p-4 { padding: 16px 20px !important; }
  .card.p-3 { padding: 14px !important; }
  .card.p-4 { padding: 16px !important; }
  .table > :not(caption) > * > * { padding: .43rem .55rem; }
  .mb-4 { margin-bottom: 1rem !important; }
}
.report-drill,.report-drill-link{cursor:pointer}.report-drill:hover{background:#f0f6ff!important;transform:translateY(-1px)}.report-drill-link{color:inherit;text-decoration:underline;text-decoration-style:dotted;text-underline-offset:3px}.drill-source-row{cursor:pointer}.drill-source-row:hover{--bs-table-bg:#eef5ff}

.attachment-preview{width:100%;height:150px;object-fit:cover;background:#f4f6f9}.attachment-preview:hover{opacity:.9}
