/* Self service request screens: new request, my requests, request detail and the manager inbox.
   The shared components (cards, buttons, badges, chips, list rows, dialog, stepper, action bar) live in self-service.css.
   Only what is specific to these four screens is here, plus the ERP control fixes for the request form. */

/* small helpers other self service screens also use */
.ss-home .ss-muted { color: var(--muted); }
.ss-home .ss-small { font-size: 12.5px; }
.ss-home .ss-mt { margin-top: 10px; }
.ss-home .ss-pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.ss-home .ss-grow { flex: 1; }
.ss-home .ss-label { display: block; margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.5; }
.ss-home .ss-star { color: var(--bad); }
.ss-home .ss-error { color: var(--bad); font-size: 12.5px; margin-top: 4px; }

/* colored icon tiles used by the document status on the profile */
.ss-page .c-wa { background: var(--st-pending-bg); color: var(--st-pending); }
.ss-page .c-or, .ss-page .c-vi, .ss-page .c-te, .ss-page .c-pi { background: var(--brand-soft); color: var(--brand-ink); }
.ss-page .c-in { background: var(--st-review-bg); color: var(--st-review); }
.ss-page .c-ok { background: var(--st-approved-bg); color: var(--st-approved); }
.ss-home .ss-ic { width: 44px; height: 44px; border-radius: 8px; display: inline-grid; place-items: center; flex: none; }
.ss-home .ss-ic svg { width: 22px; height: 22px; }

/* =========================================================================== request form */
.ss-home .ss-form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px 20px; align-items: start; }
.ss-home .ss-form-grid .ss-main { grid-column: 1; grid-row: 1; min-width: 0; }
.ss-home .ss-form-grid .ss-side { grid-column: 2; grid-row: 1 / span 2; }
.ss-home .ss-form-bar { grid-column: 1; grid-row: 2; justify-content: flex-start; margin: 0; padding: 0; border-top: 0; }
.ss-home .ss-form-bar .ss-btn { min-width: 140px; }
.ss-home .ss-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ss-home .ss-side .ss-card > b:first-child { display: block; font-size: 15.5px; margin-bottom: 8px; color: var(--ink); }

/* two column field grid. The ERP controls bring bootstrap rows and columns: the rows disappear and the columns become grid cells */
.ss-home.ss-page .ss-ff { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; align-items: start; }
.ss-home.ss-page .ss-ff > .row { display: contents; margin: 0; }
.ss-home.ss-page .ss-ff > .row::before, .ss-home.ss-page .ss-ff > .row::after { display: none; }
.ss-home.ss-page .ss-ff > .row > [class*="col-"] { float: none; width: auto; min-width: 0; padding: 0; margin: 0; }
.ss-home.ss-page .ss-ff > .row > .col-xs-12:not(.col-sm-6), .ss-home.ss-page .ss-ff > .row > .ss-ff-full { grid-column: 1 / -1; }
.ss-home.ss-page .ss-ff > .ss-note { grid-column: 1 / -1; }
.ss-home.ss-page .ss-ff .ss-ff-check { grid-column: 1 / -1; display: flex; align-items: center; min-height: 34px; margin-bottom: 12px; }
.ss-home.ss-page .ss-ff .ss-ff-check label { font-size: 13px; font-weight: 600; color: #3e342e; }
.ss-home.ss-page .ss-ff .ss-ff-check .control-group, .ss-home.ss-page .ss-ff .ss-ff-check .checkbox { margin: 0; }
.ss-home.ss-page .ss-ff .form-control { width: 100%; max-width: 100%; height: 28px; font-size: 12px; border-radius: 0; padding: 2px 6px; }
.ss-home.ss-page .ss-ff .form-group { margin-bottom: 10px; }
.ss-home.ss-page .ss-ff textarea.form-control { min-height: 60px; font-size: 12px; border-radius: 0; padding: 4px 6px; }
.ss-home.ss-page .ss-ff .ss-note { margin: 0 0 10px; font-size: 12px; }

/* date picker: full width input, the calendar icon sits inside the field end, no grey box */
.ss-home.ss-page .ss-ff .date-picker { position: relative; width: 100%; }
.ss-home.ss-page .ss-ff .date-picker .input-group { display: block; position: relative; width: 100%; }
.ss-home.ss-page .ss-ff .date-picker .form-control { width: 100%; height: 28px; padding-inline: 6px 28px; border-radius: 0; font-size: 12px; }
.ss-home.ss-page .ss-ff .date-picker .input-group-addon { position: absolute; inset-block: 0; inset-inline-end: 0; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 0; background: none; color: var(--ink-2); display: grid; place-items: center; z-index: 3; pointer-events: none; font-size: 12px; }
.ss-home.ss-page .ss-ff .date-picker.read-only .input-group-addon { color: var(--muted); cursor: default; }

/* time picker: HH : MM and the AM/PM button in one row, every part sized like a field */
.ss-home.ss-page .ss-ff .form-group > div:has(.pm-am) { display: flex; align-items: center; gap: 8px; }
.ss-home.ss-page .ss-ff .form-group > div:has(.pm-am) > div { display: flex; flex: 1; min-width: 0; direction: ltr; flex-direction: row-reverse; align-items: center; justify-content: flex-end; gap: 8px; }
.ss-home.ss-page .ss-ff .form-group > div:has(.pm-am) > div > span { float: none !important; color: var(--ink-2); font-weight: 700; }
.ss-home.ss-page .ss-ff .form-group > div:has(.pm-am) input.form-control { flex: 1; min-width: 0; width: auto !important; float: none; height: 28px; padding: 0 6px; font-size: 12px !important; text-align: center !important; border: 1px solid var(--field-line) !important; border-radius: 0; }
.ss-home.ss-page .ss-ff .pm-am { flex: none; min-width: 44px; height: 28px; padding: 0 8px; border: 1px solid var(--field-line); border-radius: 0; background: #fff; color: var(--ink); font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.ss-home.ss-page .ss-ff .pm-am:hover { background: var(--brand-soft); border-color: var(--brand); }

/* side panel */
.ss-home .ss-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.ss-home .ss-side .ss-card > b:first-child + .ss-line { border-top: 0; }
.ss-home .ss-line b { font-weight: 700; }
.ss-home .ss-balance { margin-top: 8px; padding: 10px 12px; background: var(--brand-soft); border-radius: 8px; }
.ss-home .ss-line0 { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.ss-home .ss-neg { color: var(--bad); }
.ss-home .ss-money { font-size: 26px; font-weight: 700; color: var(--ink); margin: 8px 0 2px; line-height: 1.3; }
.ss-home .ss-money small { font-size: 13px; color: var(--muted); font-weight: 400; }
.ss-home .ss-hint { display: flex; gap: 10px; padding: 12px 14px; font-size: 12.5px; margin-top: 14px; }
.ss-home .ss-hint svg { width: 20px; height: 20px; }
.ss-home .ss-hint-warn { margin-top: 0; margin-bottom: 14px; }
.ss-home .ss-path { margin-top: 12px; }
.ss-home .ss-step-text { display: flex; flex-direction: column; min-width: 0; padding-top: 3px; }

/* attachment: uses the native ERP np-file control styling without custom overrides */
.ss-home .ss-attach { margin-top: 4px; }

/* =========================================================================== my requests and inbox */
.ss-home .ss-kind-select { min-width: 160px; }
.ss-home .ss-reqlist .ss-row { min-height: 72px; }
.ss-home .ss-req-status { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; flex: none; width: 190px; }
.ss-home .ss-req-status small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.ss-home .ss-row-main > small { overflow-wrap: anywhere; }
.ss-home .ss-ib { cursor: default; }
.ss-home .ss-ib:hover { background: none; }
.ss-home .ss-ib-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; font-size: 16px; flex: none; }
.ss-home .ss-ib-main { flex: 1; min-width: 0; text-align: start; background: none; border: 0; padding: 0; font-family: inherit; color: var(--ink); cursor: pointer; display: block; }
.ss-home .ss-ib-main b { display: block; font-weight: 700; }
.ss-home .ss-ib-main small { display: block; color: var(--muted); font-size: 12.5px; }
.ss-home .ss-ib-main:hover b { color: var(--brand-ink); }
.ss-home .ss-ib-kind { display: flex !important; align-items: center; gap: 6px; }
.ss-home .ss-ib-kind svg { width: 16px; height: 16px; color: var(--brand-ink); }
.ss-home .ss-ib-status { flex: none; }

/* =========================================================================== request detail */
.ss-home .ss-detail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px 20px; align-items: start; }
.ss-home .ss-detail .ss-detail-main { grid-column: 1; grid-row: 1; min-width: 0; }
.ss-home .ss-detail .ss-detail-side { grid-column: 2; grid-row: 1 / span 2; }
.ss-home .ss-detail-bar { grid-column: 1; grid-row: 2; justify-content: flex-start; align-items: center; flex-wrap: wrap; margin: 0; padding: 0; border-top: 0; }
.ss-home .ss-detail-bar .ss-bar-hint { flex: 1; min-width: 200px; text-align: end; }
.ss-home .ss-head { display: flex; align-items: center; gap: 12px; }
.ss-home .ss-head-ic { width: 48px; height: 48px; }
.ss-home .ss-head-text { flex: 1; min-width: 0; }
.ss-home .ss-head-text h2 { margin: 0; font-size: 18px; font-weight: 700; color: var(--ink); line-height: 1.4; }
.ss-home .ss-kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.ss-home .ss-kv > div { background: none; padding: 0; min-width: 0; }
.ss-home .ss-kv small { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; color: var(--ink); }
.ss-home .ss-kv b, .ss-home .ss-readbox { display: block; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--field-ro); color: var(--ink); font-weight: 500; font-size: 14.5px; line-height: 1.6; overflow-wrap: anywhere; }
.ss-home .ss-detail-sec { margin-top: 18px; }
.ss-home .ss-detail-sec .ss-filechip + .ss-filechip { margin-top: 8px; }
.ss-home .ss-filechip { background: #fff; }
.ss-home .ss-filechip-size { direction: ltr; unicode-bidi: isolate; }
.ss-home .ss-side-title { margin: 0 0 14px; font-size: 16px; font-weight: 700; color: var(--ink); }

/* reject dialog */
.ss-home .ss-dialog-x { width: 40px; height: 40px; border: 0; border-radius: 8px; background: none; color: var(--ink-2); display: grid; place-items: center; cursor: pointer; flex: none; }
.ss-home .ss-dialog-x:hover { background: var(--field-ro); }
.ss-home .ss-dialog-sub { margin: 0 0 16px; color: var(--ink-2); }
.ss-home .ss-textarea { display: block; width: 100%; min-height: 60px; padding: 4px 6px; border: 1px solid var(--field-line); border-radius: 0; background: #fff; color: var(--ink); font-family: inherit; font-size: 12px; resize: vertical; box-shadow: none !important; }
.ss-home .ss-textarea:focus { border-color: #da9e52; box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1) !important; outline: 0; }
.ss-home .ss-textarea.invalid { border-color: var(--bad); }
.ss-home .ss-alert a { color: var(--brand-ink); }

/* ==========================================================================
   Responsive Architecture & Mobile-First Excellence for Requests & Inbox
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Medium Screens & Tablets (max-width: 900px)
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .ss-home .ss-form-grid,
  .ss-home .ss-detail {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .ss-home .ss-form-grid .ss-side,
  .ss-home .ss-detail .ss-detail-side {
    order: 2;
  }

  .ss-home .ss-form-bar,
  .ss-home .ss-detail-bar {
    order: 3;
  }

  .ss-home .ss-detail-bar .ss-bar-hint {
    flex-basis: 100%;
    text-align: start;
    margin-top: 6px;
  }
}

/* --------------------------------------------------------------------------
   2. Mobile & Phablet Screens (max-width: 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  /* --- Filters: Horizontal Chips Track + Kind Dropdown --- */
  .ss-home .ss-filters {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 16px;
  }

  .ss-home .ss-filters > .ss-grow {
    display: none;
  }

  .ss-home .ss-filters > .ss-chip,
  .ss-home .ss-filters .ss-chip {
    flex: none;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 8px;
    font-size: 13px;
    white-space: nowrap;
  }

  .ss-home .ss-kind-select {
    width: 100%;
    min-height: 42px;
    border-radius: 8px;
    font-size: 13.5px;
    padding: 0 12px;
  }

  /* --- Requests List Card View --- */
  .ss-home .ss-reqlist {
    border: 0;
    background: none;
    overflow: visible;
  }

  .ss-home .ss-reqlist .ss-row {
    flex-wrap: wrap;
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 14px;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1) !important;
    gap: 10px 12px;
  }

  .ss-home .ss-reqlist .ss-row:first-child {
    border-top: 1px solid var(--line);
  }

  .ss-home .ss-reqlist .ss-row > .ss-chev {
    order: 1;
    margin-inline-start: auto;
  }

  .ss-home .ss-req-status {
    order: 2;
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 10px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
  }

  /* --- Inbox Approval Cards --- */
  .ss-home .ss-reqlist .ss-ib {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    grid-template-areas:
      "avatar main status"
      "action action action";
    gap: 10px 12px;
    align-items: center;
    padding: 14px;
    border-radius: 8px;
    background: #fff;
    margin-bottom: 10px;
    border: 1px solid var(--line);
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1) !important;
  }

  .ss-home .ss-ib .ss-ib-avatar {
    grid-area: avatar;
    width: 44px;
    height: 44px;
    font-size: 16px;
  }

  .ss-home .ss-ib .ss-ib-main {
    grid-area: main;
    min-width: 0;
  }

  .ss-home .ss-ib .ss-ib-status {
    grid-area: status;
    flex: none;
  }

  .ss-home .ss-ib .ss-btn {
    grid-area: action;
    width: 100%;
    min-height: 42px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 8px;
    margin-top: 4px;
  }

  /* --- Key-Values on Mobile --- */
  .ss-home .ss-kv {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* --- Sticky Bottom Action Bar on Mobile --- */
  .ss-home .ss-form-bar,
  .ss-home .ss-detail-bar {
    position: sticky;
    bottom: 0;
    z-index: 20;
    margin: 16px -14px -30px;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.06);
    display: flex;
    gap: 10px;
  }

  .ss-home .ss-form-bar .ss-btn,
  .ss-home .ss-detail-bar .ss-btn {
    flex: 1;
    min-height: 46px;
    font-size: 14.5px;
    font-weight: 700;
    border-radius: 8px;
    min-width: 0;
  }

  .ss-home .ss-detail-bar .ss-bar-hint {
    display: none;
  }

  /* --- Form Inputs Touch Optimization --- */
  .ss-home.ss-page .ss-ff {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .ss-home.ss-page .ss-ff .form-control {
    height: 28px;
    font-size: 12px;
    border-radius: 0;
    padding: 2px 6px;
  }

  .ss-home.ss-page .ss-ff .date-picker .form-control {
    height: 28px;
    font-size: 12px;
    padding-inline: 6px 28px;
    border-radius: 0;
  }

  .ss-home.ss-page .ss-ff .date-picker .input-group-addon {
    width: 28px;
    height: 28px;
  }

  .ss-home.ss-page .ss-ff .pm-am {
    height: 28px;
    min-width: 44px;
    border-radius: 0;
    font-size: 12px;
  }

  .ss-home .ss-dialog {
    max-height: 90vh;
    overflow: auto;
  }

  .ss-home .ss-filechip {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    border-radius: 8px;
  }

  .ss-home .ss-filechip .ss-btn {
    width: 100%;
    min-height: 38px;
    border-radius: 8px;
    margin-top: 4px;
  }
}

/* --------------------------------------------------------------------------
   3. Small Mobile Screens (max-width: 400px)
   -------------------------------------------------------------------------- */
@media (max-width: 400px) {
  .ss-home .ss-reqlist .ss-row {
    padding: 12px 10px;
  }

  .ss-home .ss-head {
    gap: 8px;
  }

  .ss-home .ss-head-ic {
    width: 40px;
    height: 40px;
  }

  .ss-home .ss-head-text h2 {
    font-size: 16px;
  }
}
