@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Space+Mono:wght@400;700&family=Roboto:wght@400;500;700&display=swap');

:root {
  --coral:#F2643A;
  --coral-dark:#C94A24;
  --blue:#3E7CB1;
  --blue-dark:#295C87;
  --yellow:#F5C242;
  --yellow-dark:#D69E0A;
  --purple:#8B5FBF;
  --purple-dark:#6B3F9E;
  --teal:#3FA796;
  --teal-dark:#257A6C;
  --pink:#F2A0B8;
  --ink:#2B2320;
  --ink-soft:#6b5f57;
  --paper:#FFFDF8;
  --bg:#EDE3D3;
  --border:#2B2320;
  --radius:8px;
  --shadow-x:5px;
  --shadow-y:5px;
}

* {
  box-sizing:border-box;
}

body {
  font-family:'Space Mono','Courier New',monospace;
  background:
    repeating-linear-gradient(
      45deg,
      rgba(43,35,32,.035) 0 2px,
      transparent 2px 14px
    ),
    var(--bg);
  margin:0;
  padding:0;
  color:var(--ink);
}

h1,
h2,
.pixel {
  font-family:'Press Start 2P','Space Mono',monospace;
}


/* =========================================================
   HERO
========================================================= */

.win-dots {
  display:inline-flex;
  gap:6px;
  margin-right:10px;
}

.win-dots span {
  width:11px;
  height:11px;
  border-radius:50%;
  border:1.5px solid var(--border);
  display:inline-block;
}

.win-dots .d-red {
  background:#F2643A;
}

.win-dots .d-yellow {
  background:#F5C242;
}

.win-dots .d-green {
  background:#3FA796;
}


.hero {
  position:sticky;
  top:0;
  z-index:200;
  overflow:hidden;
  background:var(--blue);
  background-image:
    repeating-linear-gradient(
      135deg,
      rgba(255,255,255,.06) 0 10px,
      transparent 10px 20px
    );
  border-bottom:3px solid var(--border);
  padding:18px 24px;
  text-align:left;
  transition:padding .2s ease;
}

.hero-titlebar {
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom:4px;
}

.hero.is-stuck {
  padding:10px 24px;
}

.hero.is-stuck .hero-sub {
  display:none;
}

.hero.is-stuck h1 {
  font-size:14px;
}

.hero::after {
  content:'';
  position:absolute;
  top:8px;
  right:18px;
  width:46px;
  height:46px;
  background:var(--yellow);
  border:2px solid var(--border);
  border-radius:50%;
  box-shadow:
    var(--shadow-x)
    var(--shadow-y)
    0 rgba(0,0,0,.25);
}

.hero h1 {
  position:relative;
  color:#fff;
  font-size:19px;
  margin:0;
  line-height:1.5;
  text-shadow:
    2px 2px 0 rgba(0,0,0,.25);
}

.hero .hero-sub {
  position:relative;
  color:rgba(255,255,255,.92);
  font-size:14px;
  margin:6px 0 0;
}

.hero-back {
  position:relative;
  display:inline-block;
  margin-top:10px;
  color:#fff;
  font-size:12px;
  text-decoration:none;
  border-bottom:2px dashed rgba(255,255,255,.6);
}

.hero.is-stuck .hero-back {
  display:none;
}


/* =========================================================
   WRAPPER
========================================================= */

.wrap {
  max-width:760px;
  margin:28px auto 48px;
  padding:0 20px;
  position:relative;
}

.wrap.wide {
  max-width:1000px;
}


/* =========================================================
   CARD
========================================================= */

.card {
  background:var(--paper);
  border-radius:var(--radius);
  border:3px solid var(--border);
  box-shadow:8px 8px 0 rgba(43,35,32,.9);
  padding:24px 22px;
}


/* =========================================================
   APPROVAL TOOLBAR
========================================================= */

.approval-toolbar {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-bottom:16px;
}

.approval-title {
  font-family:'Press Start 2P','Space Mono',monospace;
  font-size:13px;
  margin:0;
}

.refresh-btn {
  flex-shrink:0;
}


/* =========================================================
   BUTTONS
========================================================= */

button,
.btn {
  display:inline-flex;
  align-items:center;
  gap:8px;
  justify-content:center;
  background:var(--purple);
  color:#fff;
  border:2.5px solid var(--border);
  padding:11px 20px;
  border-radius:6px;
  font-size:13px;
  font-weight:700;
  font-family:'Space Mono',monospace;
  text-transform:uppercase;
  letter-spacing:.3px;
  cursor:pointer;
  text-decoration:none;
  box-shadow:4px 4px 0 rgba(43,35,32,.9);
  transition:
    transform .08s,
    box-shadow .08s;
}

button:hover,
.btn:hover {
  transform:translate(-2px,-2px);
  box-shadow:6px 6px 0 rgba(43,35,32,.9);
}

button:active,
.btn:active {
  transform:translate(1px,1px);
  box-shadow:2px 2px 0 rgba(43,35,32,.9);
}

button:disabled {
  background:#cfc6b8;
  color:#8a8175;
  box-shadow:4px 4px 0 rgba(43,35,32,.35);
  cursor:not-allowed;
  transform:none;
}

.btn.secondary {
  background:#fff;
  color:var(--ink);
}

.btn.teal {
  background:var(--teal);
}

.btn.coral {
  background:var(--coral);
}

.btn.yellow {
  background:var(--yellow);
  color:var(--ink);
}

.btn.purple {
  background:var(--purple);
}

.btn.sm {
  padding:8px 13px;
  font-size:11px;
}

.btn.block {
  width:100%;
}

.btn-row {
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:14px;
}


/* =========================================================
   REQUEST CARD
========================================================= */

.req-card {
  background:var(--paper);
  border:2.5px solid var(--border);
  border-radius:8px;
  box-shadow:5px 5px 0 rgba(43,35,32,.75);
  margin-bottom:16px;
  overflow:hidden;
}

.req-card .req-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:12px 15px;
  cursor:pointer;
  flex-wrap:wrap;
}

.req-card .req-id {
  font-weight:700;
  font-size:13px;
}

.req-card .req-meta {
  font-size:11px;
  color:var(--ink-soft);
  margin-top:2px;
}

.req-card .req-body {
  display:none;
  padding:4px 15px 16px;
  border-top:2px dashed #e2d9c8;
}

.req-card .req-body.open {
  display:block;
}


/* =========================================================
   DETAIL GRID
========================================================= */

.req-detail-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:4px 18px;
  font-size:12px;
  margin:12px 0;
}

.req-detail-grid .k {
  color:var(--ink-soft);
}

.req-detail-grid .v {
  font-weight:700;
}


/* =========================================================
   REQUESTED ITEMS
========================================================= */

.requested-items-title {
  font-size:12px;
  margin:16px 0 6px;
}

.grid-table-wrap {
  overflow-x:auto;
  margin-top:8px;
  border-radius:6px;
  border:2.5px solid var(--border);
}

table.grid-table {
  width:100%;
  border-collapse:collapse;
  min-width:560px;
}

table.grid-table th {
  background:#efe9dc;
  color:var(--ink);
  text-align:left;
  font-size:10.5px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.3px;
  padding:9px 7px;
  border-bottom:2.5px solid var(--border);
  white-space:nowrap;
}

table.grid-table td {
  padding:6px;
  border-bottom:1.5px solid #e2d9c8;
  font-size:11px;
}

table.grid-table td.row-label {
  font-size:11px;
  font-weight:700;
  padding-left:9px;
  white-space:nowrap;
  color:var(--ink-soft);
}

table.grid-table tr:hover td {
  background:rgba(0,0,0,.02);
}


/* =========================================================
   PDF BUTTON
========================================================= */

.request-action-bar {
  display:flex;
  justify-content:flex-end;
  margin:4px 0 10px;
}

.pdf-btn {
  background:var(--blue);
}

.pdf-btn:hover {
  background:var(--blue-dark);
}


/* =========================================================
   FORM CONTROLS
========================================================= */

label {
  display:block;
  font-size:12px;
  font-weight:700;
  color:var(--ink);
  margin:14px 0 5px;
}

label .req {
  color:var(--coral-dark);
}

.hint {
  font-size:10.5px;
  color:var(--ink-soft);
  font-weight:400;
}

input[type=text],
input[type=password],
input[type=number],
select,
textarea {
  width:100%;
  padding:9px 11px;
  border:2px solid var(--border);
  border-radius:6px;
  font-size:13px;
  font-family:'Space Mono',monospace;
  background:#fff;
}

select {
  appearance:none;
  padding-right:36px;
}

textarea {
  min-height:70px;
  resize:vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline:none;
  box-shadow:3px 3px 0 rgba(43,35,32,.85);
}


/* =========================================================
   STATUS
========================================================= */

.status-badge {
  display:inline-block;
  padding:4px 10px;
  border-radius:20px;
  font-size:9.5px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.3px;
  border:2px solid var(--border);
  white-space:nowrap;
}

.status-pending {
  background:var(--yellow);
  color:var(--ink);
}

.status-approved {
  background:var(--teal);
  color:#fff;
}

.status-rejected {
  background:var(--coral);
  color:#fff;
}

.status-needinfo {
  background:var(--pink);
  color:var(--ink);
}

.status-takase {
  background:var(--purple);
  color:#fff;
}

.status-inprogress {
  background:var(--blue);
  color:#fff;
}

.status-completed {
  background:#6b5f57;
  color:#fff;
}


/* =========================================================
   PASSCODE
========================================================= */

.password-field {
  position:relative;
}

.password-field input {
  padding-right:44px;
}

.password-toggle {
  position:absolute;
  right:4px;
  top:50%;
  transform:translateY(-50%);
  background:none;
  border:none;
  box-shadow:none;
  padding:8px;
  font-size:16px;
  cursor:pointer;
  color:var(--ink-soft);
}

.password-toggle:hover,
.password-toggle:active {
  background:none;
  box-shadow:none;
  transform:translateY(-50%);
  color:var(--ink);
}

.gate {
  max-width:380px;
  margin:60px auto;
}

.gate .badge-lock {
  width:54px;
  height:54px;
  border-radius:10px;
  background:var(--yellow);
  border:2.5px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:26px;
  margin:0 auto 16px;
  box-shadow:4px 4px 0 rgba(43,35,32,.85);
}

.gate h2 {
  text-align:center;
  font-size:14px;
  margin:0 0 6px;
}

.gate .gate-sub {
  text-align:center;
  color:var(--ink-soft);
  font-size:11px;
  margin-bottom:20px;
}


/* =========================================================
   ERROR / SUCCESS
========================================================= */

.error {
  color:var(--coral-dark);
  background:#FFEDE4;
  border:2.5px solid var(--coral-dark);
  padding:9px 12px;
  border-radius:6px;
  font-size:12px;
  margin-top:10px;
  box-shadow:3px 3px 0 rgba(43,35,32,.5);
}

.success-banner {
  color:var(--teal-dark);
  background:#E4F7F3;
  border:2.5px solid var(--teal-dark);
  padding:9px 12px;
  border-radius:6px;
  font-size:12px;
  margin-top:10px;
}


/* =========================================================
   TOAST
========================================================= */

.toast {
  position:fixed;
  bottom:20px;
  left:50%;
  transform:translateX(-50%);
  background:var(--ink);
  color:#fff;
  padding:11px 18px;
  border-radius:8px;
  font-size:12px;
  box-shadow:4px 4px 0 rgba(0,0,0,.4);
  z-index:500;
  opacity:0;
  pointer-events:none;
  transition:
    opacity .2s,
    transform .2s;
}

.toast.show {
  opacity:1;
  transform:
    translateX(-50%)
    translateY(-6px);
}

.toast.err {
  background:var(--coral-dark);
}


/* =========================================================
   STATES
========================================================= */

.empty-state,
.loading-state {
  text-align:center;
  padding:40px 20px;
  color:var(--ink-soft);
  font-size:12px;
}

.helper {
  color:var(--ink-soft);
  font-size:11px;
}

.spinner {
  display:inline-block;
  width:13px;
  height:13px;
  border:2px solid #fff;
  border-top-color:transparent;
  border-radius:50%;
  animation:spin .7s linear infinite;
}

@keyframes spin {
  to {
    transform:rotate(360deg);
  }
}


/* =========================================================
   PDF DOCUMENT
   Hidden while using the application.
========================================================= */

#pdf-download-container {
  position:absolute;
  left:-100000px;
  top:0;
  width:1120px;
  background:#fff;
}


.pdf-document {
  width:1120px;
  min-height:790px;
  padding:20px 22px;
  background:#fff;
  color:#111;
  font-family:Arial,Helvetica,sans-serif;
  font-size:8px;
  line-height:1.15;
}


/* =========================================================
   PDF HEADER
========================================================= */

.pdf-header {
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  border-bottom:1.5px solid #222;
  padding-bottom:7px;
  margin-bottom:7px;
}

.pdf-title {
  font-size:17px;
  font-weight:700;
  letter-spacing:.2px;
}

.pdf-instruction {
  margin-top:3px;
  font-size:8px;
  font-weight:700;
}

.pdf-submission {
  font-size:8px;
  text-align:right;
}

.pdf-submission strong {
  font-size:11px;
  margin-left:6px;
}


/* =========================================================
   PDF SECTIONS
========================================================= */

.pdf-section {
  border-bottom:1.5px solid #222;
  padding:6px 0;
  page-break-inside:avoid;
}

.pdf-section-title {
  font-size:10px;
  font-weight:700;
  margin-bottom:5px;
}


/* =========================================================
   PDF BASIC INFORMATION
========================================================= */

.pdf-info-grid {
  display:grid;
  grid-template-columns:
    1fr 1.35fr
    1fr 1.35fr;
  gap:2px 16px;
}

.pdf-info-grid > div,
.pdf-conventional > div,
.pdf-condition-grid > div {
  display:flex;
  min-height:14px;
}

.pdf-info-grid span,
.pdf-conventional span,
.pdf-condition-grid span {
  width:105px;
  flex-shrink:0;
  font-weight:700;
}

.pdf-info-grid strong,
.pdf-conventional strong,
.pdf-condition-grid strong {
  font-weight:400;
}

.pdf-full-row {
  grid-column:1 / -1;
}


/* =========================================================
   PDF CONVENTIONAL
========================================================= */

.pdf-conventional {
  display:grid;
  grid-template-columns:
    1fr 1fr 1fr 1fr 1fr;
  gap:8px;
}


/* =========================================================
   PDF ITEMS
========================================================= */

.pdf-items-table {
  width:100%;
  border-collapse:collapse;
  table-layout:fixed;
}

.pdf-items-table td,
.pdf-items-table th {
  border:1px solid #222;
  padding:3px 4px;
  text-align:center;
  vertical-align:middle;
  font-size:7.5px;
}

.pdf-items-table .pdf-label-cell {
  width:95px;
  text-align:left;
  font-weight:700;
  background:#f1f1f1;
}

.pdf-item-col {
  min-width:90px;
}

.pdf-item-no {
  font-weight:700;
  margin-bottom:2px;
}


/* =========================================================
   PDF CONDITIONS
========================================================= */

.pdf-condition-grid {
  display:grid;
  grid-template-columns:
    1fr 1fr;
  gap:2px 30px;
}

.pdf-remark {
  margin-top:5px;
}

.pdf-remark-title {
  font-weight:700;
  margin-bottom:2px;
}

.pdf-remark-box {
  border:1px solid #222;
  min-height:30px;
  padding:4px;
  white-space:pre-wrap;
}


/* =========================================================
   PDF FOOTER
========================================================= */

.pdf-footer {
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  padding-top:7px;
}

.pdf-signatures {
  display:grid;
  grid-template-columns:
    repeat(4,1fr);
  width:80%;
  gap:10px;
}

.pdf-signatures > div {
  min-height:38px;
  border-bottom:1px solid #777;
}

.pdf-signatures span {
  display:block;
  font-size:7px;
  font-weight:700;
  margin-bottom:10px;
}

.pdf-signatures strong {
  display:block;
  font-size:8px;
  font-weight:400;
  text-align:center;
}

.pdf-logo {
  width:100px;
  text-align:center;
  font-size:13px;
  font-weight:700;
  letter-spacing:2px;
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width:560px) {

  .card {
    padding:18px 14px;
  }

  .wrap {
    margin:16px auto 32px;
    padding:0 12px;
  }

  .req-detail-grid {
    grid-template-columns:1fr;
  }

  .approval-toolbar {
    align-items:flex-start;
  }

}