/* The site is designed light; stop phones from auto-darkening it. */
:root { color-scheme: only light; }

/* The Print Media & Design — client portal UI. Brand: amber #fda103 on near-black. */
:root {
  --amber: #fda103;
  --amber-dark: #e08e00;
  --ink: #0a0a0a;
  --ink-2: #1b1b1b;
  --paper: #f6f7f9;
  --card: #ffffff;
  --line: #e4e7ec;
  --muted: #6b7280;
  --text: #1f2430;
  --danger: #d23b3b;
  --danger-bg: #fdeaea;
  --ok: #1b7f3b;
  --ok-bg: #e7f6ec;
  --radius: 12px;
  --shadow: 0 10px 40px rgba(10, 10, 10, 0.10);
}

* { box-sizing: border-box; }
/* Make the hidden attribute authoritative even on flex/grid containers
   (otherwise .shell/.center-load display rules keep them visible). */
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--amber-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- top bar ---- */
/* White bar: the brand logo (dark green + grey type) is built for light
   backgrounds and loses contrast on the old near-black bar. */
.pmo-topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.pmo-topbar img { height: 48px; width: auto; max-width: 62vw; object-fit: contain; display: block; }
.pmo-topbar .home-link { color: var(--muted); font-size: 14px; font-weight: 500; white-space: nowrap; }
.pmo-topbar .home-link:hover { color: var(--amber-dark); text-decoration: none; }

/* ---- auth card ---- */
.auth-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 32px;
}
.auth-card h1 {
  font-size: 24px;
  margin: 0 0 4px;
  color: var(--ink);
}
.auth-card .sub {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 24px;
}
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #374151;
}
.field input,
.field select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  background: #fff;
  color: var(--text);
}
.field select { padding-right: 32px; text-overflow: ellipsis; }
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(253, 161, 3, 0.18);
}
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

.btn {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  background: var(--amber);
  color: #1a1200;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .02s;
}
.btn:hover { background: var(--amber-dark); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: default; }

.auth-alt {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

.msg {
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 18px;
  display: none;
}
.msg.show { display: block; }
.msg.err { background: var(--danger-bg); color: var(--danger); border: 1px solid #f2c4c4; }
.msg.ok  { background: var(--ok-bg); color: var(--ok); border: 1px solid #bfe3ca; }

.row2 { display: flex; gap: 12px; }
.row2 .field { flex: 1; }

/* ---- dashboard ---- */
.dash-wrap { flex: 1; max-width: 1040px; width: 100%; margin: 0 auto; padding: 32px 24px 60px; }
.dash-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 28px; }
.dash-head h1 { font-size: 26px; margin: 0; color: var(--ink); }
.dash-head .who { color: var(--muted); font-size: 14px; margin-top: 4px; }
.logout-btn { background: transparent; border: 1px solid var(--line); color: var(--text); padding: 9px 16px; border-radius: 8px; font-size: 14px; cursor: pointer; }
.logout-btn:hover { border-color: var(--amber); color: var(--amber-dark); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 30px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px;
}
.stat .k { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 30px; font-weight: 700; color: var(--ink); margin-top: 6px; }
.stat .d { font-size: 13px; color: var(--muted); margin-top: 4px; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 22px; }
.panel h2 { font-size: 17px; margin: 0 0 16px; color: var(--ink); }
.order-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.order-row:last-child { border-bottom: none; }
.order-row .meta { color: var(--muted); font-size: 13px; }
.badge { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.badge.printing { background: #fff3df; color: #a86800; }
.badge.done { background: var(--ok-bg); color: var(--ok); }
.badge.review { background: #eef2ff; color: #4338ca; }

.quick { display: flex; flex-wrap: wrap; gap: 12px; }
.quick a { flex: 1; min-width: 160px; text-align: center; padding: 14px; border: 1px dashed var(--line); border-radius: 10px; color: var(--text); font-weight: 600; font-size: 14px; }
.quick a:hover { border-color: var(--amber); color: var(--amber-dark); text-decoration: none; background: #fffaf0; }

.empty-note { color: var(--muted); font-size: 14px; background: #fbfbfc; border: 1px dashed var(--line); border-radius: 10px; padding: 16px; }

.center-load { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 15px; }

.pmo-foot { text-align: center; color: var(--muted); font-size: 13px; padding: 20px; border-top: 1px solid var(--line); background: #fff; }

/* ---- dashboard shell (sidebar + content) ---- */
.shell { flex: 1; display: flex; align-items: stretch; width: 100%; }
.sidebar {
  width: 232px; flex-shrink: 0; background: var(--ink); color: #cfd2d8;
  padding: 22px 14px; display: flex; flex-direction: column; gap: 4px;
}
.sidebar .side-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6b7280; padding: 12px 12px 6px; }
.sidebar a {
  display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 8px;
  color: #cfd2d8; font-size: 14px; font-weight: 500; text-decoration: none;
}
.sidebar a:hover { background: #1b1b1b; color: #fff; text-decoration: none; }
.sidebar a.active { background: var(--amber); color: #1a1200; font-weight: 700; }
.sidebar a .ic { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar .spacer { flex: 1; }
.sidebar .side-logout {
  border: none; cursor: pointer; text-align: left; width: 100%; background: transparent;
  font-family: inherit;
}

.content { flex: 1; min-width: 0; background: var(--paper); padding: 30px 34px 60px; }
.content-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 26px; }
.content-head h1 { font-size: 24px; margin: 0; color: var(--ink); }
.content-head .who { color: var(--muted); font-size: 14px; margin-top: 3px; }

.stat .ic-badge { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px; background: #fff7ea; margin-bottom: 10px; }

/* table */
.table-wrap { overflow-x: auto; }
table.orders { width: 100%; border-collapse: collapse; font-size: 14px; }
table.orders th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 0 14px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.orders td { padding: 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.orders tr:last-child td { border-bottom: none; }
table.orders .oid { font-weight: 700; color: var(--ink); }
table.orders .link { color: var(--amber-dark); font-weight: 600; cursor: pointer; }
.badge.pending { background: #f3f4f6; color: #4b5563; }
.badge.shipped { background: #e0f2fe; color: #0369a1; }
/* invoice states */
.badge.paid { background: var(--ok-bg); color: var(--ok); }
.badge.unpaid { background: #fff3df; color: #a86800; }
.badge.overdue { background: var(--danger-bg); color: var(--danger); }

/* proofs */
.proofs { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.proof { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.proof .thumb { height: 120px; background: linear-gradient(135deg, #fef0d6, #fde0a8); display: flex; align-items: center; justify-content: center; color: #a86800; font-weight: 700; font-size: 13px; }
.proof .pbody { padding: 13px 14px; }
.proof .pbody .pt { font-weight: 600; font-size: 14px; color: var(--ink); }
.proof .pbody .pd { font-size: 12px; color: var(--muted); margin: 3px 0 11px; }
.proof .pact { display: flex; gap: 8px; }
.btn-sm { flex: 1; padding: 8px; border-radius: 7px; font-size: 12.5px; font-weight: 700; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--text); }
.btn-sm.approve { background: var(--amber); border-color: var(--amber); color: #1a1200; }
.btn-sm.approve:hover { background: var(--amber-dark); }
.btn-sm.changes:hover { border-color: var(--amber); color: var(--amber-dark); }
/* Size buttons from their labels so "Request changes" stays on one line. */
.proof .pact .btn-sm { flex: 1 1 auto; white-space: nowrap; padding: 8px 10px; }

.section-note { font-size: 12.5px; color: var(--muted); background: #fbfbfc; border: 1px dashed var(--line); border-radius: 8px; padding: 10px 13px; margin-top: 4px; }

.mobile-nav { display: none; }

@media (max-width: 860px) {
  /* Stack the menu bar ABOVE the content. In the default row layout the bar
     became a full-height column beside the content and pushed it off-screen. */
  .shell { flex-direction: column; }
  .sidebar { display: none; }
  .content { padding: 22px 18px 50px; width: 100%; }
  .mobile-nav {
    display: flex; align-items: center; gap: 8px; overflow-x: auto; flex-shrink: 0;
    background: var(--ink); padding: 10px 14px;
    position: sticky; top: 0; z-index: 20;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .mobile-nav::-webkit-scrollbar { display: none; }
  .mobile-nav a { color: #cfd2d8; font-size: 13px; white-space: nowrap; padding: 7px 12px; border-radius: 7px; }
  .mobile-nav a.active { background: var(--amber); color: #1a1200; font-weight: 700; }
  /* Keep section headings clear of the sticky bar when jumping to them. */
  .panel, .cards, #top { scroll-margin-top: 64px; }
}
@media (max-width: 480px) {
  .auth-card { padding: 26px 20px; }
  .row2 { flex-direction: column; gap: 0; }
  .pmo-topbar { padding: 10px 16px; }
  .pmo-topbar img { height: 40px; }
  .content-head h1 { font-size: 21px; }
  .content-head .btn { width: 100% !important; text-align: center; }
  .cards { grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 22px; }
  .stat { padding: 14px 15px; }
  .stat .v { font-size: 24px; }
  .stat .k { font-size: 11.5px; }
  .stat .d { font-size: 12px; }
  .panel { padding: 18px 16px; }
}

/* ---- order form (employees) + approvals (managers) ---- */
.topbar-links { display: flex; align-items: center; gap: 18px; }
.wrap { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 28px 24px 56px; }
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.page-head h1 { font-size: 24px; margin: 0; color: var(--ink); }
.page-head .who { color: var(--muted); font-size: 14px; margin-top: 4px; }
.req { color: var(--danger); }
.fine { font-size: 12.5px; color: var(--muted); margin: 12px 0 0; line-height: 1.5; }
.btn-auto { width: auto; padding: 11px 22px; }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { background: #fff; border-color: var(--amber); color: var(--amber-dark); }

.order-grid { display: grid; grid-template-columns: minmax(0, 1fr) 392px; gap: 22px; align-items: start; }
.order-grid[hidden] { display: none !important; }
.form-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 16px; }
.field select, .field input { min-width: 0; max-width: 100%; }
.form-fields .field-wide { grid-column: 1 / -1; }
.field-err { font-size: 12px; color: var(--danger); margin-top: 4px; }
.field.has-err input, .field.has-err select { border-color: var(--danger); }
.preview-panel { position: sticky; top: 16px; }
.pv { width: 100%; overflow: hidden; }

.done { text-align: center; padding: 40px 24px; }
.done h2 { font-size: 22px; margin-bottom: 8px; }
.done-icon { width: 56px; height: 56px; line-height: 56px; border-radius: 50%; margin: 0 auto 14px; background: var(--ok-bg); color: var(--ok); font-size: 28px; font-weight: 700; }

.req-card .req-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin-bottom: 16px; }
.req-card .req-head .fine { margin: 0; }
.req-body { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 22px; align-items: start; }
.kvs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.kv span { display: block; font-size: 11.5px; color: var(--muted); }
.kv b { font-size: 13.5px; font-weight: 600; color: var(--ink); word-break: break-word; }
.req-actions { display: flex; gap: 10px; margin-top: 18px; }
.decided { font-weight: 700; font-size: 14px; padding: 10px 14px; border-radius: 8px; }
.decided.ok { background: var(--ok-bg); color: var(--ok); }
.decided.no { background: var(--danger-bg); color: var(--danger); }

@media (max-width: 900px) {
  .order-grid { grid-template-columns: minmax(0, 1fr); }
  .preview-panel { position: static; order: -1; }
  .req-body { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .wrap { padding: 20px 16px 48px; }
  .page-head h1 { font-size: 21px; }
  .form-fields { grid-template-columns: minmax(0, 1fr); }
  .kvs { grid-template-columns: minmax(0, 1fr); }
  .topbar-links { gap: 12px; }
  .req-actions .btn { flex: 1; }
}
