/* Tamworth IT Support — Client Portal v1 */
:root {
  --blue:       #0b63f6;
  --blue-deep:  #0846c7;
  --blue-ink:   #062e86;
  --orange:     #ff6200;
  --red:        #e31b2c;
  --green:      #1a7f4e;
  --bg:         #f5f9ff;
  --card:       #ffffff;
  --line:       #dde6f0;
  --text:       #1a2233;
  --muted:      #5a6a80;
  --radius:     12px;
  --sidebar-w:  220px;
  font-family: 'Outfit', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); min-height: 100vh; font-size: 15px; line-height: 1.6; }
a { color: var(--blue); }
a:hover { text-decoration: underline; }
p { margin-bottom: .85rem; }
p:last-child { margin-bottom: 0; }

/* ── Auth pages (login / register / forgot) ─────────────────────────────── */
.p-auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: linear-gradient(135deg, #062e86 0%, #0b63f6 100%);
}
.p-auth-box {
  background: var(--card);
  border-radius: 18px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 8px 40px rgba(6,46,134,.22);
}
.p-auth-logo {
  display: block;
  width: 180px;
  margin: 0 auto 1.5rem;
}
.p-auth-title {
  font-size: 1.4rem;
  font-weight: 780;
  color: var(--blue-ink);
  text-align: center;
  margin-bottom: .35rem;
}
.p-auth-sub {
  color: var(--muted);
  text-align: center;
  font-size: .9rem;
  margin-bottom: 1.6rem;
}

/* ── First-login hint ───────────────────────────────────────────────────── */
.p-first-login-hint {
  display: flex;
  gap: .65rem;
  align-items: flex-start;
  background: #eef4ff;
  border: 1px solid #c5d8fb;
  border-radius: 10px;
  padding: .85rem 1rem;
  margin-top: 1.2rem;
  font-size: .84rem;
  line-height: 1.55;
  color: #2a3a6a;
}
.p-first-login-hint svg {
  flex-shrink: 0;
  margin-top: .1rem;
  stroke: var(--blue);
}
.p-first-login-hint a { color: var(--blue); font-weight: 650; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.p-form-group { margin-bottom: 1rem; }
.p-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.p-label { display: block; font-size: .85rem; font-weight: 680; color: var(--blue-ink); margin-bottom: .35rem; }
.p-input, .p-select, .p-textarea {
  width: 100%;
  padding: .62rem .85rem;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: .95rem;
  color: var(--text);
  background: #fff;
  transition: border-color .15s;
}
.p-input:focus, .p-select:focus, .p-textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(11,99,246,.12);
}
.p-textarea { resize: vertical; min-height: 100px; }
.p-input-hint { font-size: .8rem; color: var(--muted); margin-top: .3rem; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.p-btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem 1.4rem;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: filter .15s, transform .1s;
  line-height: 1;
}
.p-btn:hover { filter: brightness(1.08); text-decoration: none; }
.p-btn:active { transform: scale(.98); }
.p-btn-primary  { background: var(--blue);   color: #fff; }
.p-btn-orange   { background: var(--orange); color: #fff; }
.p-btn-ghost    { background: transparent; border: 1.5px solid var(--blue); color: var(--blue); }
.p-btn-danger   { background: var(--red);    color: #fff; }
.p-btn-green    { background: var(--green);  color: #fff; }
.p-btn-sm       { padding: .45rem .9rem; font-size: .85rem; }
.p-btn-full     { width: 100%; justify-content: center; }

/* ── Flash messages ─────────────────────────────────────────────────────── */
.p-flash { padding: .85rem 1rem; border-radius: 8px; margin-bottom: 1.2rem; font-size: .92rem; font-weight: 600; }
.p-flash-ok  { background: #e8f9ef; color: #1a7f4e; border: 1px solid #b0e9c9; }
.p-flash-err { background: #fff2f3; color: #b81020; border: 1px solid #ffbcc0; }

/* ── Client layout ──────────────────────────────────────────────────────── */
.p-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 12px rgba(6,46,134,.07);
}
.p-topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.p-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  flex-shrink: 0;
}
.p-brand-logo {
  height: 44px;
  width: auto;
  display: block;
}
.p-brand-divider {
  display: block;
  width: 1px;
  height: 28px;
  background: var(--line);
  flex-shrink: 0;
}
.p-brand-sub {
  font-size: .8rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .02em;
  white-space: nowrap;
}
.p-nav { display: flex; align-items: center; gap: .2rem; margin-left: auto; }
.p-nav a {
  padding: .4rem .75rem;
  border-radius: 7px;
  font-size: .9rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}
.p-nav a:hover, .p-nav a.active { color: var(--blue-ink); background: var(--bg); }
.p-nav-cta {
  background: var(--blue) !important;
  color: #fff !important;
  padding: .4rem .9rem !important;
  border-radius: 7px;
  font-weight: 700 !important;
}
.p-nav-cta:hover { background: var(--blue-deep) !important; }

.p-user-menu { position: relative; }
.p-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-weight: 780;
  font-size: .9rem;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.p-avatar-sm { width: 32px; height: 32px; flex-shrink: 0; font-size: .8rem; }
.p-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 200px;
  padding: .75rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
  z-index: 200;
}
.p-dropdown[hidden] { display: none; }
.p-dropdown-name { font-weight: 700; font-size: .9rem; color: var(--blue-ink); margin-bottom: .15rem; }
.p-dropdown-email { font-size: .8rem; color: var(--muted); margin-bottom: .5rem; }
.p-dropdown hr { border: none; border-top: 1px solid var(--line); margin: .5rem 0; }
.p-dropdown a { display: block; padding: .3rem 0; font-size: .9rem; color: var(--text); text-decoration: none; }
.p-dropdown a:hover { color: var(--blue); }

.p-main {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}
.p-page-title {
  font-size: 1.5rem;
  font-weight: 780;
  color: var(--blue-ink);
  margin-bottom: 1.4rem;
}
.p-page-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.4rem;
  flex-wrap: wrap;
}
.p-page-head h1 { font-size: 1.4rem; font-weight: 780; color: var(--blue-ink); margin: 0; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.p-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.p-card-title {
  font-size: 1rem;
  font-weight: 750;
  color: var(--blue-ink);
  margin-bottom: .8rem;
}
.p-card + .p-card { margin-top: 1.2rem; }
.p-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.p-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.p-stat-val { font-size: 2rem; font-weight: 800; color: var(--blue); line-height: 1; margin-bottom: .3rem; }
.p-stat-label { font-size: .85rem; color: var(--muted); font-weight: 600; }

/* ── Table ──────────────────────────────────────────────────────────────── */
.p-table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); }
.p-table { width: 100%; border-collapse: collapse; background: #fff; }
.p-table th {
  text-align: left;
  padding: .7rem 1rem;
  font-size: .8rem;
  font-weight: 750;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.p-table td {
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--line);
  font-size: .9rem;
  color: var(--text);
}
.p-table tr:last-child td { border-bottom: none; }
.p-table tr:hover td { background: #f8fbff; }
.p-table a { text-decoration: none; font-weight: 650; }

/* ── Badges / status ────────────────────────────────────────────────────── */
.p-badge {
  display: inline-block;
  padding: .22rem .65rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 750;
  letter-spacing: .02em;
  white-space: nowrap;
}
.status-pending     { background: #fef3c7; color: #92400e; }
.status-approved    { background: #d1fae5; color: #065f46; }
.status-declined    { background: #fee2e2; color: #991b1b; }
.status-inprogress  { background: #dbeafe; color: #1e40af; }
.status-completed   { background: #e0e7ff; color: #3730a3; }
.status-cancelled   { background: #f3f4f6; color: #6b7280; }
.status-client-active  { background: #d1fae5; color: #065f46; }
.status-client-pending { background: #fef3c7; color: #92400e; }
.status-client-suspended { background: #fee2e2; color: #991b1b; }

/* ── Ticket detail ──────────────────────────────────────────────────────── */
.p-ticket-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.p-meta-item label { display: block; font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .25rem; }
.p-meta-item p { font-size: .95rem; color: var(--blue-ink); font-weight: 650; margin: 0; }

.p-comments { margin-top: 1.4rem; }
.p-comment {
  display: flex;
  gap: .85rem;
  margin-bottom: 1rem;
}
.p-comment-av {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 780;
  font-size: .85rem;
  color: #fff;
}
.p-comment-av-client { background: var(--blue); }
.p-comment-av-admin  { background: var(--orange); }
.p-comment-body {
  flex: 1;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .85rem 1rem;
}
.p-comment-head {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .4rem;
}
.p-comment-name { font-weight: 700; font-size: .88rem; color: var(--blue-ink); }
.p-comment-time { font-size: .78rem; color: var(--muted); }
.p-comment-text { font-size: .92rem; color: var(--text); }

/* ── Dashboard banner ───────────────────────────────────────────────────── */
.p-dashboard-banner {
  background: linear-gradient(120deg, var(--blue-ink) 0%, var(--blue) 100%);
  padding: 0;
}
.p-dashboard-banner-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.p-dashboard-hello {
  font-size: 1.55rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 .2rem;
  line-height: 1.2;
}
.p-dashboard-company {
  font-size: .9rem;
  color: rgba(255,255,255,.65);
  margin: 0;
}
.p-dashboard-newjob {
  background: #fff !important;
  color: var(--blue-ink) !important;
  font-weight: 780;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
  white-space: nowrap;
}
.p-dashboard-newjob:hover { filter: brightness(.96); }

/* ── Stat cards ─────────────────────────────────────────────────────────── */
.p-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
  margin-bottom: 1.4rem;
}
.p-stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  border-top: 3px solid transparent;
  box-shadow: 0 2px 8px rgba(6,46,134,.05);
}
.p-stat-blue   { border-top-color: var(--blue); }
.p-stat-orange { border-top-color: var(--orange); }
.p-stat-green  { border-top-color: var(--green); }
.p-stat-icon svg { width: 22px; height: 22px; }
.p-stat-blue   .p-stat-icon { color: var(--blue); }
.p-stat-orange .p-stat-icon { color: var(--orange); }
.p-stat-green  .p-stat-icon { color: var(--green); }
.p-stat-num {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--blue-ink);
}
.p-stat-lbl { font-size: .82rem; font-weight: 650; color: var(--muted); }

/* ── Admin sidebar layout ───────────────────────────────────────────────── */
.is-admin { display: flex; min-height: 100vh; }
.p-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--blue-ink);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.p-sidebar-brand {
  padding: 1.1rem 1.2rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .4rem;
}
.p-sidebar-logo {
  height: 30px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
  opacity: .92;
}
.p-sidebar-brand-label {
  font-size: .72rem;
  font-weight: 700;
  color: rgba(255,255,255,.5);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.p-sidebar-nav { flex: 1; padding: .75rem .6rem; display: flex; flex-direction: column; gap: .25rem; }
.p-sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem .75rem;
  border-radius: 8px;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: .88rem;
  font-weight: 600;
}
.p-sidebar-nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.p-sidebar-nav a:hover, .p-sidebar-nav a.active { background: rgba(255,255,255,.12); color: #fff; }
.p-sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  gap: .7rem;
}
.p-sidebar-name { font-size: .82rem; font-weight: 700; color: #fff; margin: 0; }
.p-sidebar-signout { font-size: .75rem; color: rgba(255,255,255,.6); text-decoration: none; }
.p-sidebar-signout:hover { color: #fff; }

.p-admin-body { flex: 1; min-width: 0; }
.p-admin-main { max-width: 1000px; margin: 0 auto; padding: 2rem 1.5rem; }
.p-admin-topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.p-admin-topbar h1 { font-size: 1.15rem; font-weight: 780; color: var(--blue-ink); margin: 0; }

/* ── Filters bar ────────────────────────────────────────────────────────── */
.p-filters {
  display: flex;
  gap: .75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}
.p-filters .p-select { width: auto; min-width: 140px; }
.p-filters .p-input  { width: auto; min-width: 200px; }

/* ── Misc ───────────────────────────────────────────────────────────────── */
.p-divider { border: none; border-top: 1px solid var(--line); margin: 1.2rem 0; }
.p-back { font-size: .85rem; color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: .3rem; margin-bottom: 1rem; }
.p-back:hover { color: var(--blue); }
.p-empty { text-align: center; padding: 3rem 1rem; color: var(--muted); font-size: .95rem; }
.p-empty svg { width: 48px; height: 48px; stroke: var(--line); margin-bottom: .75rem; display: block; margin-left: auto; margin-right: auto; }
.p-tag-admin { font-size: .72rem; font-weight: 750; background: #fef3c7; color: #92400e; border-radius: 4px; padding: .1rem .35rem; margin-left: .35rem; }

.p-pricing-info {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .85rem 1rem;
  font-size: .88rem;
  color: var(--muted);
  margin-top: .35rem;
}
.p-pricing-info strong { color: var(--blue-ink); }
.p-cost-preview {
  font-size: 1.1rem;
  font-weight: 780;
  color: var(--blue-ink);
  background: #eef3ff;
  border: 1px solid #c0d0f8;
  border-radius: 8px;
  padding: .7rem 1rem;
  margin-top: .5rem;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .p-grid-2, .p-grid-3, .p-stat-grid { grid-template-columns: 1fr; }
  .p-sidebar { display: none; }
  .is-admin .p-admin-body { width: 100%; }
}
@media (max-width: 600px) {
  .p-form-row { grid-template-columns: 1fr; }
  .p-auth-box { padding: 1.75rem 1.25rem; }
  .p-table th:nth-child(n+4), .p-table td:nth-child(n+4) { display: none; }
  .p-brand-sub, .p-brand-divider { display: none; }
  .p-brand-logo { height: 36px; }
  .p-topbar-inner { height: 62px; }
  .p-dashboard-hello { font-size: 1.2rem; }
  .p-stat-grid { grid-template-columns: 1fr 1fr; }
}
