/* The live app's own stylesheet, taken from /assets/index-DtcsCLY7.css and
   un-minified. Class names and values are unchanged, so the views use the same
   class names the React app used: .app-shell, .content, .data-table, .stat-card,
   .status-pill, .ci-card, and so on. */

:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --border: #2a2f3a;
  --text: #e8eaed;
  --muted: #9399a6;
  --accent: #5b8cff;
  --green: #35c07a;
  --red: #ff6b6b;
  --yellow: #e0b74d;
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }

body { background: var(--bg); color: var(--text); margin: 0; }
a { color: var(--accent); }

.app-shell { min-height: 100vh; display: flex; }

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  flex-direction: column;
  gap: 24px;
  width: 220px;
  height: 100vh;
  padding: 20px 14px;
  display: flex;
  position: sticky;
  top: 0;
}

.sidebar .brand { font-size: 1.1rem; font-weight: 700; }
.sidebar nav { flex-direction: column; flex: 1; gap: 4px; display: flex; }

.sidebar nav a {
  color: var(--muted);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: .92rem;
  text-decoration: none;
}

.sidebar nav a.active,
.sidebar nav a:hover { background: var(--panel-2); color: var(--text); }

.user-box { border-top: 1px solid var(--border); padding-top: 12px; font-size: .85rem; }
.user-name { font-weight: 600; }
.user-role { color: var(--muted); text-transform: capitalize; margin-bottom: 8px; }
.user-box button { width: 100%; }

.content { flex: 1; max-width: 1200px; padding: 28px 36px; }

h1 { margin: 0 0 4px; }
.muted { color: var(--muted); }
.warn { color: var(--yellow); }
.error { color: var(--red); margin: 8px 0; font-size: .9rem; }
.negative { color: var(--red); }
.profit { color: var(--green); }

.page-header {
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  display: flex;
}

button {
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: .88rem;
}

button:hover { opacity: .9; }
button:disabled { opacity: .5; cursor: not-allowed; }

input, select {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  width: 100%;
  padding: 7px 9px;
  font-size: .9rem;
}

label {
  color: var(--muted);
  margin-top: 8px;
  margin-bottom: 4px;
  font-size: .78rem;
  display: block;
}

.card-form {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 16px 0;
  padding: 16px 18px;
}

.form-row { flex-wrap: wrap; gap: 14px; display: flex; }
.form-row > div { flex: 1; min-width: 160px; }
.card-form button { margin-top: 14px; }

.stat-row { flex-wrap: wrap; gap: 14px; margin: 18px 0 24px; display: flex; }

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  flex: 1;
  min-width: 180px;
  padding: 16px 20px;
}

.stat-label { color: var(--muted); margin-bottom: 6px; font-size: .8rem; }
.stat-value { font-size: 1.5rem; font-weight: 700; }

.data-table { border-collapse: collapse; width: 100%; margin-top: 8px; }

.data-table th,
.data-table td {
  text-align: left;
  border-bottom: 1px solid var(--border);
  padding: 9px 10px;
  font-size: .88rem;
}

.data-table th {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .03em;
  font-size: .78rem;
  font-weight: 600;
}

.data-table td.actions { gap: 6px; display: flex; }

.status-pill { text-transform: capitalize; border-radius: 999px; padding: 2px 9px; font-size: .76rem; }
.status-pending { color: var(--yellow); background: #4a3d1a; }
.status-verified { color: #6fc3ff; background: #1a3a4a; }
.status-paid { color: var(--green); background: #163d29; }
.status-confirmed { color: var(--green); background: #163d29; }

.ci-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
  padding: 14px 18px;
}

.ci-head { margin-bottom: 6px; }
.ci-costs { color: var(--muted); gap: 16px; margin-bottom: 10px; font-size: .85rem; display: flex; flex-wrap: wrap; }
.ci-videos ul, .ci-payments ul { margin: 6px 0; padding-left: 18px; font-size: .88rem; }
.inline-add { gap: 8px; margin-top: 6px; display: flex; flex-wrap: wrap; }
.inline-add input { flex: 1; }

.login-page {
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  display: flex;
  /* Padding plus max-width below: with a fixed-width flex item, centring
     overflows on BOTH sides once the viewport is narrower than the card, and the
     left edge becomes unreachable. Shows up on a zoomed-in browser or a phone. */
  padding: 20px;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 340px;
  max-width: 100%;
  padding: 32px 36px;
}

.login-card h1 { margin-bottom: 0; }
.login-card .subtitle { color: var(--muted); margin-top: 4px; margin-bottom: 12px; font-size: .85rem; }
.login-card button { width: 100%; margin-top: 16px; }

.page-loading { text-align: center; color: var(--muted); padding: 40px; }

.warning-banner {
  color: var(--yellow);
  background: #3a2a12;
  border: 1px solid #6b4a1a;
  border-radius: 8px;
  margin-bottom: 16px;
  padding: 10px 14px;
  font-size: .88rem;
}

.approval-pill { border-radius: 999px; padding: 2px 9px; font-size: .76rem; }
.approval-pending { color: var(--yellow); background: #4a3d1a; }
.approval-approved { color: var(--green); background: #163d29; }
.approval-rejected { color: var(--red); background: #4a1a1a; }
.approval-not_required { color: var(--muted); }

.mark-paid-form {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  flex-direction: column;
  gap: 8px;
  max-width: 320px;
  margin-top: 8px;
  padding: 12px;
  display: flex;
}

.mark-paid-form label { margin-top: 0; }

.budget-bar-track {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  height: 14px;
  overflow: hidden;
}

.budget-bar-fill { background: var(--accent); height: 100%; }
.budget-bar-fill.over { background: var(--red); }

.button-file {
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  border-radius: 6px;
  align-items: center;
  padding: 8px 14px;
  font-size: .88rem;
  display: inline-flex;
}

/* Added for the Yii2 port. The React app had no server-rendered flash messages,
   and wide tables need to scroll on narrow screens. */

.flash-error {
  color: var(--red);
  background: #3a1616;
  border: 1px solid #6b2a2a;
  border-radius: 8px;
  margin-bottom: 16px;
  padding: 10px 14px;
  font-size: .88rem;
}

.table-wrap { overflow-x: auto; }
.section { margin: 28px 0 8px; font-size: 1rem; font-weight: 600; }
.backlink { font-size: .85rem; text-decoration: none; }
form.inline { display: inline; }
.empty { color: var(--muted); padding: 24px 10px; }

/* The login form markup uses these two; the React app styled its fields inline,
   so they have no rule in the original stylesheet. */
.field { margin-bottom: 4px; }
.help-block { color: var(--red); margin-top: 4px; font-size: .8rem; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; }

/* Payment Requests: the mark-paid form sits in its own full-width row under the
   request, not inside the narrow Actions cell where every label wrapped. Hidden
   until the button adds .open — `hidden` alone loses to a display rule on <tr>. */
tr.pay-row { display: none; }
tr.pay-row.open { display: table-row; }
tr.pay-row > td { background: var(--panel-2); }
tr.pay-row .form-row { align-items: flex-end; }
tr.pay-row .pay-submit { flex: 0 0 auto; min-width: 0; }

/* Not in the live stylesheet — used by a few forms in this port. */
.button-sm { padding: 6px 11px; font-size: .82rem; }
.button-ghost { background: var(--panel-2); }
.button-ghost:hover { background: var(--border); opacity: 1; }
.flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Campaign PI-number editor. Native <dialog>, so the backdrop, focus trap and
   Esc-to-close come from the browser rather than from JS. */

.icon-button {
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  padding: 5px 7px;
  line-height: 0;
  display: inline-flex;
  align-items: center;
}

.icon-button:hover { color: var(--text); background: var(--border); }

.log-count {
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-left: 6px;
  padding: 1px 7px;
  font-size: .72rem;
  vertical-align: middle;
}

.app-dialog {
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: min(460px, calc(100vw - 32px));
  max-height: 84vh;
  padding: 0;
  overflow: hidden;
}

.app-dialog::backdrop { background: #000c; }

.dialog-head {
  border-bottom: 1px solid var(--border);
  padding: 16px 18px 13px;
}

.dialog-head h3 { margin: 0 0 3px; font-size: 1rem; }
.dialog-head .muted { font-size: .82rem; }

.dialog-body { max-height: 54vh; overflow-y: auto; padding: 16px 18px; }
.dialog-body input[type="text"] { width: 100%; }

.dialog-foot {
  border-top: 1px solid var(--border);
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 18px;
  display: flex;
}

.log-list { display: flex; flex-direction: column; gap: 8px; }

.log-item {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-radius: 6px;
  padding: 8px 11px;
}

.log-change { font-size: .84rem; word-break: break-word; }
.log-change s { color: var(--muted); }
.log-meta { color: var(--muted); margin-top: 3px; font-size: .76rem; }

/* Error page (views/site/error.php). */
.error-page { max-width: 560px; padding: 48px 0; }
.error-page h1 { margin: 0 0 8px; font-size: 1.4rem; }

.error-code {
  color: var(--muted);
  letter-spacing: -.02em;
  margin-bottom: 4px;
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
}

/* Centres a standalone page inside the blank layout, which has no wrapper of its own.
   Same reasoning as .login-page: padding plus max-width on the child, so centring
   can't push the left edge off-screen on a narrow viewport. */
.center-page {
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  display: flex;
}
