/*
 * theme-2026.css — INISIATIF 2 visual redesign (Phase 8-10).
 *
 * Pure additive override layer, loaded AFTER custom.css in base/main.blade.php.
 * Does not modify/delete anything in stylehealth.min.css or custom.css — to
 * roll back, delete this file and its one <link> line in main.blade.php.
 *
 * Scope: color, typography, and component visual style ONLY (border-radius,
 * shadow, spacing of existing elements). No layout/structure changes — this
 * file never touches position/display/grid-column properties of AdminLTE's
 * layout skeleton (.main-sidebar width/transform, .content-wrapper margins,
 * Bootstrap .col-* classes), so the existing responsive behavior (off-canvas
 * mobile sidebar via body.sidebar-open, 2-up stat cards on xs/sm, stacked
 * charts on mobile) is inherited unchanged from stylehealth.min.css.
 *
 * Token values approved by user via HTML/CSS mockup iteration, 2026-08-07.
 * Do not reinterpret these hex values.
 */

:root {
  --ink: #123539;
  --ink-soft: #1c464b;
  --paper: #f4f7f7;
  --surface: #ffffff;
  --surface-sunken: #eaf0f0;
  --line: #dde6e6;
  --line-soft: #e8eeee;
  --text: #16262a;
  --text-muted: #62787a;
  --text-faint: #94a6a7;
  --teal: #0f9488;
  --teal-strong: #0c7c72;
  --teal-wash: #e2f3f0;
  --blue: #2f6fed;
  --blue-strong: #2557c0;
  --blue-wash: #e7eefe;
  --sage: #22a06b;
  --sage-strong: #17875a;
  --sage-wash: #e1f4ea;
  --coral: #e0523a;
  --coral-strong: #c53f28;
  --coral-wash: #fbe4de;
  --amber: #f0a020;
  --amber-strong: #c9800e;
  --amber-wash: #fdf0d9;
  --focus: #0c7c72;
  --shadow-1: 0 1px 2px rgba(15, 42, 46, 0.06);
  --shadow-2: 0 8px 22px rgba(15, 42, 46, 0.09);
  --radius-s: 6px;
  --radius-m: 10px;
  --font-system: -apple-system, "Segoe UI", "Segoe UI Variable", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ==========================================================================
   Typography — system stack everywhere the old theme hardcoded a webfont.
   ========================================================================== */
body,
.main-sidebar,
.sidebar-menu,
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6,
.logo-lock,
.error-desc p {
  font-family: var(--font-system) !important;
}

body {
  color: var(--text);
  background-color: var(--paper);
}

/* ==========================================================================
   Page chrome: header bar, sidebar, page title bar
   ========================================================================== */
.main-header {
  background-color: var(--ink);
}
.main-header .navbar {
  background-color: var(--ink);
}
.main-header .sidebar-toggle {
  color: var(--teal-strong);
}
.main-header .navbar-custom-menu .dropdown-menu {
  border-color: var(--line);
}

.main-sidebar,
.sidebar-menu,
.sidebar-menu .treeview-menu {
  background-color: var(--ink);
}
.user-panel {
  background-color: var(--ink-soft);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.user-panel .info h4,
.user-panel .info p,
.user-panel .info a {
  /* Dark panel background needs explicit light text — the base theme's
     default h4 color (near-black) was never meant to sit on a dark card,
     so it silently inherited an unreadable color once we darkened this
     panel. */
  color: #ffffff;
}
.user-panel .info p {
  color: rgba(255, 255, 255, 0.75);
}
.sidebar-menu > li > a {
  color: #b7c4bf;
}
.sidebar-menu > li:hover > a,
.sidebar-menu > li.active > a {
  color: #ffffff;
  background: var(--ink-soft);
}
.sidebar-menu > li.active > a:before {
  background: var(--teal);
  color: var(--teal);
}
.sidebar-menu .treeview-menu > li > a {
  color: #a7b6b1;
}
.sidebar-menu .treeview-menu > li.active > a,
.sidebar-menu .treeview-menu > li:hover > a {
  color: var(--teal-strong);
}
/* Collapsed-sidebar hover flyout (fixed 2026-08-06 for z-index/coverage) —
 * keep that fix's box-shadow/left/width/padding intact, just recolor. */
.sidebar-mini.sidebar-collapse .sidebar-menu > li:hover > .treeview-menu {
  background-color: var(--ink);
}

.content-header {
  background-color: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: none;
}
.header-icon {
  color: var(--teal);
}
.header-title h1 {
  color: var(--text);
}
.content-header .breadcrumb {
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  color: var(--text-muted);
}
.content-header .breadcrumb > li > a {
  color: var(--text-muted);
}

/* ==========================================================================
   Cards / panels — used app-wide (index tables, forms, dashboard widgets)
   ========================================================================== */
.panel-bd,
.panel-primary,
.panel-success,
.panel-info,
.panel-warning,
.panel-danger,
.panel-inverse {
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-1);
}
.panel-body {
  background: var(--surface);
  border: none;
  border-radius: 0 0 var(--radius-m) var(--radius-m);
  /* Bootstrap's default is 15px, which reads as cramped now that
     surrounding elements (cardbox, buttons, inputs) all got more
     generous spacing — most noticeable on panels with no .panel-heading
     (e.g. the dashboard's date-filter panel), where content used to sit
     nearly flush against the card edge. Padding only, no structural
     change: doesn't move/resize any element, just gives existing
     content more breathing room inside the same box. */
  padding: 20px;
}
/* Some older pages (e.g. Marketing > Pasien Tidak Kembali's "Total Pasien"
   summary card) hardcode an inline background-color + white text directly
   on the .panel to highlight a stat — the rule above was unconditionally
   painting every .panel-body white on top of that, turning the card
   invisible (white text on a white background neither the card's author
   nor this rule intended). Let the inline-styled parent's color show
   through instead of overriding it. */
.panel[style*="background-color"] > .panel-body {
  background: transparent;
  border-radius: 0 0 var(--radius-m) var(--radius-m);
}
.panel-bd > .panel-heading {
  background-color: var(--surface);
  color: var(--text);
  border-color: var(--line);
  border-radius: var(--radius-m) var(--radius-m) 0 0;
}
.panel-bd .panel-heading::before {
  content: none;
}

/* ==========================================================================
   Buttons — shape refined app-wide; hue changed only for primary (brand),
   NOT for success/warning/danger/info, which keep their existing semantic
   colors (those mean "safe/caution/destructive", unrelated to brand color).
   ========================================================================== */
.btn {
  border-radius: var(--radius-s);
}
.btn-primary,
.btn-primary.btn-transparent,
.btn-primary.btn-outline {
  background-color: var(--teal);
  border-color: var(--teal);
  color: #fff;
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  background-color: var(--teal-strong);
  border-color: var(--teal-strong);
}
a { color: var(--teal); }
a:hover, a:focus { color: var(--teal-strong); }
::selection { background: var(--teal); }

/* ==========================================================================
   Dashboard stat cards ("cardbox") — quiet white card + tinted icon badge,
   replacing the old flat solid-color block. Cardbox only exists on the
   dashboard view (resources/views/contents/dasboard.blade.php), so these
   selectors cannot leak onto other pages even though some use ".row".
   ========================================================================== */
.cardbox,
.cardbox:hover {
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-1);
  color: var(--text);
  /* base stylesheet gives this a fixed height:120px (stylehealth.min.css) —
     fine for the old flat single-line card, not enough once the number and
     the icon+label both need their own room. Let content decide the height
     instead of clipping/overflowing it. */
  height: auto;
  min-height: 120px;
}
.cardbox:hover {
  box-shadow: var(--shadow-2);
}
.cardbox .panel-body {
  background: transparent;
  /* base stylesheet lays this out with .statistic-box h2 { float: right }
     and the template inline-styles .items (icon+label) as
     position:absolute — two legacy techniques fighting each other, which is
     exactly what caused the reported bugs: the float collapses its own
     container's height, and the absolutely-positioned .items doesn't
     contribute to its parent's height at all, so it rendered outside the
     card's (fixed, too-short) box entirely (reported 2026-08-17).
     Flexbox is the current standard approach for this exact "content block
     top, icon+label block bottom, same card" pattern — replaces both
     legacy techniques instead of patching around them. */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}
.cardbox .statistic-box h2 {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  /* overrides the base stylesheet's float:right — a float here fights the
     flex column above (and can collapse .statistic-box's own height);
     text-align gets the same right-aligned look without either problem. */
  float: none;
  text-align: right;
}
.cardbox .items {
  /* overrides the template's inline style="position: absolute;" (a !important
     is required — inline styles otherwise beat any stylesheet rule) so this
     participates in the flex column above instead of being pulled out of
     flow. Also drops Bootstrap's .pull-left float, redundant now and not
     meaningful in a flex context anyway. */
  position: static !important;
  float: none;
}
.cardbox .items h4 {
  color: var(--text-muted);
  font-weight: 600;
}
.cardbox .items > i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 15px;
  /* the blade template sets padding-bottom:30px inline on this element for
     the old layout's icon/label stacking — override it to fit the badge */
  padding-bottom: 0 !important;
}

/* Badge tint per stat-card group, in DOM order: "Bulan Ini" -> teal,
   "Hari Ini" -> blue, "Aesthetic" -> sage, "Gigi" -> coral. Both the
   "Pasien ..." row and the admin-only "Omset ..." row follow the same
   4-card pattern, so nth-child(4n+k) covers both.
   Anchored directly on the column's own class (not ".row > div") because
   the dashboard view's filter-form has a stray unclosed <div> (pre-existing
   template bug, out of scope to fix here) that leaves the DOM with the
   stat-card <div class="row"> nested a level deeper than the source implies.
   A ".row > div:nth-child()" selector matched that whole wrapping row by
   coincidence; selecting the column by its own compound class avoids
   depending on which element is its ".row" ancestor at all. */
.col-xs-6.col-sm-6.col-md-6.col-lg-3:nth-child(4n+1) > .cardbox .items > i { background: var(--teal-wash); color: var(--teal-strong); }
.col-xs-6.col-sm-6.col-md-6.col-lg-3:nth-child(4n+2) > .cardbox .items > i { background: var(--blue-wash); color: var(--blue-strong); }
.col-xs-6.col-sm-6.col-md-6.col-lg-3:nth-child(4n+3) > .cardbox .items > i { background: var(--sage-wash); color: var(--sage-strong); }
.col-xs-6.col-sm-6.col-md-6.col-lg-3:nth-child(4n+4) > .cardbox .items > i { background: var(--coral-wash); color: var(--coral-strong); }

/* ==========================================================================
   Chart panel gridlines/background (Chart.js line/bar colors are configured
   in JS, see dasboard.blade.php + DashboardController — this just covers the
   surrounding chart card chrome).
   ========================================================================== */
.lobidrag .panel-heading,
.lobidisable .panel-heading {
  background-color: var(--surface);
}

/* ==========================================================================
   Responsive — no new breakpoints/structure, just make sure the redesigned
   components stay legible at the widths AdminLTE already reflows to.
   Bootstrap's existing col-xs-6 (dashboard cards) and col-xs-12 (charts)
   classes already give 2-up cards and stacked charts on phones; this only
   trims stat-card padding/type-scale so the new white-card + badge look
   doesn't feel oversized in the narrower column.
   ========================================================================== */
@media (max-width: 767px) {
  .cardbox .statistic-box h2 {
    font-size: 32px;
    /* base stylesheet floats this right at a fixed font-size with no wrap
       allowance, so a long formatted value (e.g. "86,84M") on a narrow
       2-up mobile card (col-xs-6) overflows past the card's left edge
       instead of shrinking/wrapping. A float's shrink-to-fit width plus
       max-width:100% collapses to 0 in Chromium when the value is long
       enough to need wrapping (tested, reproduced) — dropping the float
       for a plain right-aligned block sidesteps that entirely and still
       matches the original right-aligned look. Scoped to this breakpoint
       only — desktop has room and relies on the base stylesheet's float
       to sit the number beside the icon/label instead of stacked above
       it; applying this unscoped broke that desktop layout (2026-08-17). */
    float: none;
    display: block;
    width: 100%;
    text-align: right;
    overflow-wrap: break-word;
    word-break: break-word;
  }
  .cardbox .items h4 {
    font-size: 14px;
  }
  .content-header {
    padding: 12px 15px;
  }
}

@media (min-width: 768px) {
  /* Bootstrap's col-sm-1/col-sm-2 form labels (e.g. "Tanggal" filters on the
     dashboard, Penjualan Produk, and other pages sharing this pattern) are
     too narrow to hold a real word without truncating — this isn't just a
     tablet problem, the same truncation showed up on a normal desktop-width
     screen too, so this is intentionally NOT capped at an upper width.
     Stack the label above its field instead of squeezing them side-by-side.
     Scoped to control-label so it only affects narrow label columns, not
     every form field.
     Not scoped to .form-horizontal: several pages (e.g. product_sells/index)
     use this exact col-sm-1/col-md-1 label + col-sm-3 field pattern inside a
     plain <div class="form-group">, no <form class="form-horizontal"> wrapper
     at all — scoping to .form-horizontal silently excluded those pages. */
  .control-label.col-sm-1,
  .control-label.col-sm-2 {
    float: none;
    width: 100%;
    text-align: left;
    padding-bottom: 6px;
  }
  /* Deliberately NOT touching the sibling field div(s) here (an earlier
     version of this fix forced the very next div to float:none;width:100%,
     which works when a page combines its input+button into one div (e.g.
     dashboard, product_sells) but breaks pages that use separate divs for
     the input and each button (e.g. marketing/age-treatment: label + date
     input div + button div; marketing/non-returning: label + select div +
     2 button divs) — forcing only the *first* sibling to 100% width
     stranded the button(s) alone on their own row below it, since floats
     no longer had a non-full-width predecessor to sit beside.
     Leaving the siblings alone lets Bootstrap's own col-md-N / col-sm-N float
     + percentage-width rules do their job unmodified: once the label no
     longer occupies a column (it's a full-width block now), every sibling
     div simply wraps below it and lines up next to *each other* at their
     original widths — correct for 1 sibling or several. */
}

@media (max-width: 550px) {
  .cardbox .items > i {
    width: 28px;
    height: 28px;
    font-size: 13px;
  }
  .cardbox .statistic-box h2 {
    font-size: 24px;
  }
}

/* 2026-08-18 client feedback (Item Faktur / Item Pesanan tables — Purchase
   Order & Purchase Invoice, create + edit): the browser's native spin-button
   arrows on number inputs were wide enough to overlap the Qty/Diskon
   columns' own narrow width, visually cutting off digits (e.g. "10,00"
   rendered as "10,0" with the last character hidden under the arrows) —
   easy to misread as a wrong number, and clicking an arrow nudges the
   value by a whole step per click (confusing on a price/qty field, not
   the fine control it looks like). Removing the native spinner on these
   specific inputs only (not every number input site-wide) frees up the
   full column width for the actual value and removes the accidental-click
   risk; typing/pasting a value still works exactly the same. */
.item-qty,
.item-price,
.item-discount-value {
  -moz-appearance: textfield;
}
.item-qty::-webkit-outer-spin-button,
.item-qty::-webkit-inner-spin-button,
.item-price::-webkit-outer-spin-button,
.item-price::-webkit-inner-spin-button,
.item-discount-value::-webkit-outer-spin-button,
.item-discount-value::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* 2026-08-19 client feedback: on a small laptop screen, the "Detail Produk"
   / "Item Faktur" / "Item Pesanan" tables (Purchase Order, Purchase
   Invoice — #itemsTable — and the equivalent Biaya "Rincian Biaya" table,
   #linesTable) were hard to use — 8-9 columns of inputs squeezed the whole
   row down until each box was too narrow to see what was typed in it.
   These tables already sit inside a Bootstrap .table-responsive wrapper
   (which adds horizontal scroll once the table doesn't fit), but nothing
   stopped the browser from shrinking every column to cram the table into
   the viewport *instead* of triggering that scroll. Giving the table a
   real minimum width forces the intended behavior: columns keep a usable
   size and the row scrolls sideways on a narrow screen, rather than every
   input becoming illegibly thin. Purely a layout change — doesn't touch
   any of the JS that reads these tables by row/cell (row.querySelector,
   closest('tr'), etc.), since the DOM structure itself is unchanged. */
#itemsTable,
#linesTable {
  min-width: 900px;
}
#itemsTable .item-qty,
#itemsTable .item-price,
#itemsTable .item-discount-value {
  min-width: 70px;
}
#itemsTable select.item-product {
  min-width: 160px;
}
#itemsTable select.item-tax-rate {
  min-width: 110px;
}

/* 2026-10-14: stylehealth's `.active .badge { color: #9875ab !important }`
   left an active tab's count unreadable on the blue badge (Stok Menipis,
   Slow Moving & Dead Stock). */
.nav-tabs > li.active > a .badge {
  color: #fff !important;
}
