/* NEED buttons: four tiers, one size (Ryan 2026-10-30: "info type buttons
   are the lighter blue, action buttons are the darker blue, weight bearing
   buttons like archive are the washed yellow color").

     Info     open, view, show, go somewhere, every file link ("PDF ↗"):
              pale blue, blue text.
     Action   save, add, confirm, receive, upload, sign, submit: solid dark
              blue, white text.
     Lasting  archive, retire, delete, void, dismiss, cancel an order, close
              short, unlink, deactivate, un-sign, remove a logged entry:
              washed yellow, on the button that asks AND on the dialog's
              button that does it. Red is never a button colour (it stays
              for error text).
     Quiet    Cancel, Close, Back: white, gray border. Rightmost in a footer.

   One size: a 44 px tap target, 14 px Title Case text (Ryan 2026-10-30:
   every word capitalised but a, an, the, and, or, of, to, in, on, at ...
   when not first: "Save Order", "Mark at the Painter"), 6 px corners; the
   small variant drops to 13 px and less padding but keeps the 44 px target.

   Loaded right after tokens.css by _layout.html and by every page that does
   not extend it but shows buttons. The tokens below are what each family's
   own sheet points at, so a family keeps its class names and its tests:
     .prod-btn (production.css)      base Info, -primary Action, -lasting
                                      Lasting, -quiet Quiet; .prod-link-btn
                                      a link, -lasting its Lasting colour
     .mc-btn (mrp_count.css)         base Info, -primary Action, -lasting
                                      Lasting, -quiet / -cancel Quiet
     .uinv-btn (unit_invoices.css)   base Quiet, -primary Action, -lasting
                                      Lasting
     .ur-btn (unit_received.css)     base Quiet, .ur-edit Info, .ur-save Action
     .pp-admin-btn (flyout.css)      base / -edit / -reinstate Info,
                                      -download Action, -archive Lasting,
                                      -cancel Quiet; .pp-file-chip Info
     .bo-btn (mrp_orders.html)       base Info, .primary Action, .bo-rm
                                      Lasting, .quiet Quiet
     .btn (here)                     base Info, -primary Action, -lasting
                                      Lasting, -secondary / -cancel Quiet,
                                      -small */

:root {
  --btn-info-bg:        #E8F4FC;   /* tokens.css --blue-pale */
  --btn-info-border:    #CCE7F5;   /* --blue-mid */
  --btn-info-text:      #0066B2;   /* --blue-dark */
  --btn-info-hover:     #CCE7F5;   /* --blue-mid */
  --btn-action-bg:      #0066B2;   /* --blue-dark */
  --btn-action-text:    #FFFFFF;
  --btn-action-hover:   #00508C;   /* the one hover shade */
  --btn-lasting-bg:     #FFF5E5;
  --btn-lasting-border: #F5C674;
  --btn-lasting-text:   #8A5A00;
  --btn-lasting-hover:  #F5C674;
  --btn-quiet-bg:       #FFFFFF;
  --btn-quiet-border:   #D1DAE2;   /* --gray-300 */
  --btn-quiet-text:     #1A2733;   /* --text */
  --btn-quiet-hover:    #F5F7FA;   /* --gray-100 */
  --btn-height:         44px;
  --btn-radius:         6px;
  --btn-font-size:      14px;
  --btn-font-size-small: 13px;
}

/* The generic family: standalone pages (PN generator, ECs, sign-in ...),
   the flyout's Edit details dialog and the duplicate-check panel. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  box-sizing: border-box; min-height: var(--btn-height); min-width: 44px; padding: 0 14px;
  border: 1.5px solid var(--btn-info-border); border-radius: var(--btn-radius);
  background: var(--btn-info-bg); color: var(--btn-info-text);
  font-family: inherit; font-size: var(--btn-font-size); font-weight: 700; line-height: 1.2;
  letter-spacing: normal; text-transform: none; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--btn-info-hover); }
.btn:focus-visible { outline: 3px solid #27A9E1; outline-offset: 1px; }
.btn-primary {
  background: var(--btn-action-bg); border-color: var(--btn-action-bg); color: var(--btn-action-text);
}
.btn-primary:hover { background: var(--btn-action-hover); border-color: var(--btn-action-hover); }
.btn-lasting {
  background: var(--btn-lasting-bg); border-color: var(--btn-lasting-border); color: var(--btn-lasting-text);
}
.btn-lasting:hover { background: var(--btn-lasting-hover); }
.btn-secondary, .btn-cancel {
  background: var(--btn-quiet-bg); border-color: var(--btn-quiet-border); color: var(--btn-quiet-text);
}
.btn-secondary:hover, .btn-cancel:hover { background: var(--btn-quiet-hover); }
.btn-small { font-size: var(--btn-font-size-small); padding: 0 10px; }
.btn:disabled, .btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* A bilingual label's Korean half (.lbl-ko, base.css gray) takes the
   button's own colour, so it reads on every tier. */
:is(.btn, .prod-btn, .mc-btn, .pp-admin-btn, .uinv-btn) :is(.lbl-ko, .lbl-sep) { color: inherit; opacity: 0.8; }

/* Where buttons sit (phase 2, Ryan 2026-10-30: "lets try to unify location
   and style as much as possible").
     Page actions   one bar right of the page title: .page-head holds the
                    title, then .page-actions; on a phone the bar wraps under
                    the title. Info first, then Action, the main one
                    rightmost. A Lasting action (Delete unit, Deactivate)
                    goes first of all, set apart by a wider gap.
     Home sections  the same per section: its title left, its actions right
                    in its heading (index.html .rail-actions). The home
                    Actions panel's large buttons (.home-tile, and Build's
                    and Buy & Stock's .home-card with its small buttons
                    inside) are Info, each group's one Action (.is-act)
                    last: Upload Invoice in Build, Receive in Buy & Stock.
     Row actions    small buttons (-small) or the row's "⋯" menu, on the row.
     Dialog footer  the main button first, Cancel / Close rightmost; a Lasting
                    button beside an Action goes first, set apart the same
                    way. A form's own row (Save, Cancel) stays at its foot.
   A Lasting action asks first in a NEED dialog (need_confirm.js below),
   never the browser's confirm(). */
.page-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 16px;
}
.page-actions {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end;
  gap: 8px; margin: 0 0 0 auto;
}
/* The Lasting action first in a bar or a footer (the flyout's Info card row
   too: its Archive): a wider gap after it, unless all that follows is
   Cancel (then it is the dialog's main button). */
:is(.page-actions, .mc-dialog-foot, .pp-info-actions) > :is(.btn-lasting, .prod-btn-lasting, .mc-btn-lasting, .pp-admin-btn-archive)
  + :not(.btn-secondary, .btn-cancel, .mc-btn-cancel, .prod-btn-quiet) { margin-left: 16px; }
@media (max-width: 599px) {
  .page-actions { flex-basis: 100%; justify-content: flex-start; margin-left: 0; }
}

/* NEED's confirm (static/js/need_confirm.js): the question, what it does,
   the button that does it, then Cancel rightmost. Above every other layer. */
.need-confirm-backdrop {
  position: fixed; inset: 0; z-index: 10100; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(0, 0, 0, 0.45);
}
.need-confirm {
  box-sizing: border-box; width: 100%; max-width: 440px; max-height: calc(100vh - 32px); overflow: auto;
  padding: 20px; border-radius: 10px; background: #FFFFFF; color: #1A2733;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); font-family: inherit; text-align: left;
}
.need-confirm:focus { outline: none; }
.need-confirm-title { margin: 0 0 8px; font-size: 18px; font-weight: 700; line-height: 1.3; }
.need-confirm-text { margin: 0; font-size: 14px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.need-confirm-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 18px; }
/* Its optional box (a reason to type first: needConfirm's input). */
.need-confirm-label { display: block; margin-top: 14px; font-size: 14px; font-weight: 600; }
.need-confirm-input {
  box-sizing: border-box; display: block; width: 100%; min-height: 44px; margin-top: 6px; padding: 8px 10px;
  border: 1px solid #B8C4CE; border-radius: 6px; font: inherit; font-weight: 400;
}
