/* =====================================================
   ITPOINT Connectivity Portal — Design System
   ===================================================== */

:root {
  --itp-dark: #0a2540;
  --itp-accent: #00a3e0;
  --itp-light: #f5f7fa;
  --itp-border: #d5dae0;
  --itp-warning-bg: #fff8e1;
  --itp-warning-border: #f0c040;
  --itp-warning-text: #6b5800;
  --itp-success-bg: #e8f5e9;
  --itp-success-border: #4caf50;
  --itp-success-text: #1b5e20;
  --itp-info-bg: #e3f2fd;
  --itp-info-border: #1976d2;
  --itp-info-text: #0d47a1;
  --itp-danger: #cc0000;
  --text-dark: #1a1a1a;
  --text-muted: #555;
  --text-light: #888;
  --field-bg: #fafbfc;
  --radius: 6px;
  --shadow: 0 2px 8px rgba(0,0,0,0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-dark);
  background: var(--itp-light);
}

a { color: var(--itp-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--itp-dark);
  color: #fff;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  gap: 16px;
}
.brand {
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-logo {
  height: 36px;
}
.brand-sub {
  color: #9bbcd8;
  font-size: 12px;
  font-style: italic;
}
.header-end {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: auto;
  flex-shrink: 0;
}
.header-partner {
  line-height: 0;
}
.header-partner-img {
  display: block;
  height: 70px;
  width: auto;
  max-width: min(380px, 48vw);
  object-fit: contain;
  object-position: right center;
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}
.header-nav a {
  color: #9bbcd8;
  font-size: 14px;
}
.header-nav a:hover { color: #fff; text-decoration: none; }
.user-chip {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}
.accent-line {
  background: var(--itp-accent);
  height: 3px;
}
@media (max-width: 720px) {
  .header-partner-img { height: 54px; }
  .brand-sub { display: none; }
}
@media (max-width: 520px) {
  .header-end { gap: 12px; }
  .header-partner-img { height: 44px; max-width: 52vw; }
  .header-nav { gap: 10px; font-size: 13px; }
  .header-nav a { font-size: 13px; }
}

/* ---------- Main ---------- */
.main-content {
  padding: 32px 24px 64px;
  min-height: calc(100vh - 200px);
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--itp-dark);
  color: #9bbcd8;
  margin-top: 64px;
  font-size: 12px;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 20px 24px;
  gap: 16px;
}
.footer-left strong { color: #fff; }
.footer-right { font-style: italic; }

/* ---------- Typography ---------- */
h1 {
  color: var(--itp-dark);
  font-size: 28px;
  margin: 0 0 8px;
}
h2 {
  color: var(--itp-dark);
  font-size: 18px;
  margin: 24px 0 12px;
}
h3 {
  color: var(--itp-dark);
  font-size: 15px;
  margin: 0 0 8px;
}
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.lead { font-size: 16px; color: var(--text-muted); }
.ref {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: 0.85em;
  color: var(--itp-accent);
  background: rgba(0,163,224,0.08);
  padding: 2px 8px;
  border-radius: 4px;
}
.req { color: var(--itp-danger); }

/* ---------- Hero / landing ---------- */
.hero {
  text-align: center;
  padding: 40px 0 24px;
}
.hero h1 { font-size: 38px; margin-bottom: 8px; }
.hero-sub { font-size: 18px; color: var(--text-muted); max-width: 700px; margin: 0 auto; }
.hero-cta { margin-top: 28px; }
.hero-note { margin-top: 12px; font-size: 14px; }
.button-lg { font-size: 1.05rem; padding: 14px 32px; }
.card-cta { margin-top: 20px; margin-bottom: 0; }
.info-card--accent { border: 2px solid var(--itp-accent); background: #f0f9fc; }
.info-card--muted { font-size: 13px; }
.webhook-test-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-top: 16px;
}
.webhook-test-form label { flex: 1; min-width: 200px; }
.webhook-test-form input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px;
  border: 1px solid var(--itp-border);
  border-radius: var(--radius);
}
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 24px;
}
@media (max-width: 700px) { .info-grid { grid-template-columns: 1fr; } }
.info-card, .card {
  background: #fff;
  border: 1px solid var(--itp-border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.info-card h2, .card h2 { margin-top: 0; }
.info-grid--symmetric .info-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.info-grid--symmetric .steps { flex: 1; }
.section-hint {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 16px;
  line-height: 1.5;
}
.pir-form .section-hint--inset {
  margin: 16px 18px 12px;
}
.service-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.pir-form .service-type-grid--inset {
  padding: 0 18px 18px;
}
@media (max-width: 640px) {
  .service-type-grid { grid-template-columns: 1fr; }
}
/* Override .pir-form label column layout for request-type cards */
.pir-form label.service-type-option {
  display: block;
  font-weight: 400;
  min-height: 120px;
  padding: 16px;
  border: 2px solid var(--itp-border);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.pir-form label.service-type-option:has(input:checked) {
  border-color: var(--itp-accent);
  background: #f0f9fc;
}
.service-type-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
}
.service-type-option input[type="radio"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--itp-accent);
  cursor: pointer;
}
.service-type-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.service-type-label {
  display: block;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.35;
  color: var(--itp-dark);
}
.service-type-desc {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.45;
}
.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
}
.steps li {
  margin: 12px 0;
  padding-left: 36px;
  position: relative;
}
.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0; top: 0;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--itp-accent);
  color: #fff;
  text-align: center;
  font-weight: bold;
  font-size: 13px;
  line-height: 24px;
}

/* ---------- Buttons ---------- */
.button-primary, .button-secondary {
  display: inline-block;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}
.button-primary {
  background: var(--itp-accent);
  color: #fff;
  border-color: var(--itp-accent);
}
.button-primary:hover { background: #0086b8; border-color: #0086b8; text-decoration: none; }
.button-secondary {
  background: #fff;
  color: var(--itp-dark);
  border-color: var(--itp-border);
}
.button-secondary:hover { background: var(--itp-light); text-decoration: none; }
.link-button {
  background: none; border: none; padding: 0;
  color: var(--itp-accent); cursor: pointer; font-size: inherit; font-family: inherit;
}
.link-button:hover { text-decoration: underline; }
.link-button.danger { color: var(--itp-danger); }
.inline { display: inline; }

/* ---------- Forms ---------- */
.form-header { margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--itp-accent); }
.form-header h1 .muted-divider { color: var(--text-muted); font-weight: 400; }
.title-sub { color: var(--text-muted); font-weight: 400; font-size: 0.7em; }
.form-intro { color: var(--text-muted); }
.invite-hint {
  background: var(--itp-info-bg);
  border-left: 3px solid var(--itp-info-border);
  padding: 8px 12px;
  border-radius: 4px;
  color: var(--itp-info-text);
}

.pir-form fieldset.section {
  background: #fff;
  border: 1px solid var(--itp-border);
  border-radius: var(--radius);
  padding: 0;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.pir-form legend {
  background: var(--itp-dark);
  color: #fff;
  width: 100%;
  display: block;
  padding: 10px 18px;
  font-weight: bold;
  font-size: 14px;
  border-left: 4px solid var(--itp-accent);
}
.pir-form .sec-num {
  color: var(--itp-accent);
  margin-right: 8px;
}
.pir-form .row {
  display: grid;
  gap: 16px;
  padding: 16px 18px;
}
.pir-form .row.one-col   { grid-template-columns: 1fr; }
.pir-form .row.two-col   { grid-template-columns: 1fr 1fr; }
.pir-form .row.three-col { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 700px) {
  .pir-form .row.two-col, .pir-form .row.three-col { grid-template-columns: 1fr; }
}
.pir-form label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  gap: 6px;
}
.pir-form .muted-inline { font-weight: 400; color: var(--text-muted); font-size: 0.9em; }
.pir-form textarea.textarea-field,
.pir-form .textarea-field {
  border: 1px solid var(--itp-border);
  background: var(--field-bg);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 400;
  font-family: inherit;
  width: 100%;
  min-height: 120px;
  resize: vertical;
  line-height: 1.5;
}
.pir-form textarea.textarea-field:focus,
.pir-form .textarea-field:focus {
  outline: none;
  border-color: var(--itp-accent);
  box-shadow: 0 0 0 3px rgba(0,163,224,0.15);
  background: #fff;
}
.pir-form input[type="text"], .pir-form input[type="email"], input[type="email"], input[type="text"] {
  border: 1px solid var(--itp-border);
  background: var(--field-bg);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 400;
  font-family: inherit;
  width: 100%;
}
.pir-form input:focus, input:focus {
  outline: none;
  border-color: var(--itp-accent);
  box-shadow: 0 0 0 3px rgba(0,163,224,0.15);
  background: #fff;
}

.equipment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 16px 18px;
}
/* Section 5 — same grid as section 4; observations tile spans full row */
.equipment-grid--notes {
  grid-template-columns: 1fr 1fr;
  padding: 16px 18px;
  gap: 16px;
}
.equipment-grid--notes .equipment-grid__hint {
  margin: 0;
  padding: 0;
  grid-column: 1 / -1;
}
.equipment-grid--notes .equipment-tile--full {
  grid-column: 1 / -1;
  width: 100%;
}
@media (max-width: 700px) { .equipment-grid { grid-template-columns: 1fr; } }
@media (max-width: 700px) {
  .equipment-grid--notes { grid-template-columns: 1fr; }
  .equipment-grid--notes .equipment-tile--full { grid-column: 1; }
}
.equipment-tile {
  border: 1px solid var(--itp-border);
  border-radius: var(--radius);
  background: var(--itp-light);
  overflow: hidden;
}
.equipment-tile-header {
  background: var(--itp-light);
  padding: 8px 12px;
  font-weight: bold;
  color: var(--itp-dark);
  font-size: 13px;
  border-bottom: 1px solid var(--itp-border);
}
.equipment-tile .row { padding: 12px; }
/* Textarea inside equipment tiles — match Brand/Model inputs */
.pir-form .equipment-tile label textarea {
  border: 1px solid var(--itp-border);
  background: var(--field-bg);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 400;
  font-family: inherit;
  width: 100%;
  min-height: 100px;
  line-height: 1.5;
  resize: vertical;
  box-sizing: border-box;
}
.pir-form .equipment-tile label textarea:focus {
  outline: none;
  border-color: var(--itp-accent);
  box-shadow: 0 0 0 3px rgba(0,163,224,0.15);
  background: #fff;
}

.form-actions {
  background: #fff;
  border: 1px solid var(--itp-border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}
.legal { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }

/* ---------- Alerts ---------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
  border: 1px solid;
}
.alert-warning {
  background: var(--itp-warning-bg);
  border-color: var(--itp-warning-border);
  color: var(--itp-warning-text);
  margin: 16px 18px;
}
.alert-error {
  background: #fdecea;
  border-color: var(--itp-danger);
  color: #991111;
}
.alert-success {
  background: var(--itp-success-bg);
  border-color: var(--itp-success-border);
  color: var(--itp-success-text);
}

/* ---------- Confirmation ---------- */
.confirmation {
  text-align: center;
  padding: 40px 0;
}
.confirmation-icon {
  width: 72px; height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--itp-success-bg);
  color: var(--itp-success-text);
  border: 3px solid var(--itp-success-border);
  font-size: 36px;
  line-height: 66px;
  font-weight: bold;
}
.confirmation-box {
  background: #fff;
  border: 1px solid var(--itp-border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 24px auto;
  max-width: 600px;
  text-align: left;
}
.confirmation-box table { width: 100%; }
.confirmation-box th {
  text-align: left;
  padding: 6px 12px;
  background: var(--itp-light);
  font-size: 13px;
  width: 200px;
}
.confirmation-box td { padding: 6px 12px; }

/* ---------- Error state ---------- */
.error-state { text-align: center; padding: 48px 0; }

/* ---------- Login card ---------- */
.login-card {
  background: #fff;
  border: 1px solid var(--itp-border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 480px;
  margin: 32px auto;
  box-shadow: var(--shadow);
}
.stack { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.stack label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.login-lead { margin: 0 0 20px; font-size: 15px; line-height: 1.55; color: var(--text-muted); }
.login-remember {
  flex-direction: row !important;
  align-items: center;
  gap: 10px !important;
  font-weight: 500 !important;
  font-size: 13px !important;
}
.login-remember input[type="checkbox"] { width: auto; margin: 0; }
.login-fallback {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--itp-border);
}
.login-fallback summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--itp-navy);
}
.login-fallback .stack { margin-top: 12px; }
.login-alt { margin-top: 20px; font-size: 14px; }

/* ---------- Admin dashboard ---------- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}
.page-actions { display: flex; gap: 8px; }
.back-link { font-size: 13px; color: var(--text-muted); display: inline-block; margin-bottom: 4px; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}
@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
.kpi {
  background: #fff;
  border: 1px solid var(--itp-border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.kpi-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-value { font-size: 32px; font-weight: bold; color: var(--itp-dark); margin-top: 4px; }

/* ---------- Tables ---------- */
.table-wrap {
  background: #fff;
  border: 1px solid var(--itp-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  background: var(--itp-dark);
  color: #fff;
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.data-table td {
  padding: 12px 14px;
  border-top: 1px solid var(--itp-border);
  font-size: 14px;
  vertical-align: top;
}
.data-table tbody tr:hover { background: var(--itp-light); }
.data-table .num { text-align: center; font-weight: 600; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-submitted   { background: #e3f2fd; color: #0d47a1; }
.badge-under_review{ background: #fff8e1; color: #6b5800; }
.badge-proposal_sent { background: #f3e5f5; color: #4a148c; }
.badge-accepted    { background: #e8f5e9; color: #1b5e20; }
.badge-rejected    { background: #fdecea; color: #991111; }
.badge-active      { background: #e8f5e9; color: #1b5e20; }
.badge-used        { background: #eceff1; color: #455a64; }
.badge-expired     { background: #fff8e1; color: #6b5800; }
.badge-revoked     { background: #fdecea; color: #991111; }
.badge-draft       { background: #eceff1; color: #455a64; }
.badge-sent        { background: #e3f2fd; color: #0d47a1; }
.badge-public      { background: #e8f4fc; color: #0a2540; font-size: 10px; }

/* ---------- Forms grid (admin) ---------- */
.grid-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.grid-form .full-row { grid-column: 1 / -1; }
.grid-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
@media (max-width: 700px) { .grid-form { grid-template-columns: 1fr; } }

/* ---------- Key-value ---------- */
.kv {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 6px 16px;
  margin: 0;
}
.kv dt { color: var(--text-muted); font-size: 13px; }
.kv dd { margin: 0; font-size: 14px; }

.grid-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 700px) { .grid-cols { grid-template-columns: 1fr; } }

.observations-text {
  margin: 0;
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-dark);
}

/* ---------- Equipment list (admin view) ---------- */
.equipment-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
@media (max-width: 700px) { .equipment-list { grid-template-columns: 1fr; } }
.equipment-line {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--itp-light);
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 13px;
}
.equipment-num { color: var(--itp-accent); font-weight: bold; min-width: 30px; }
.equipment-brand { font-weight: 600; }
.equipment-sep { color: var(--text-muted); }
.equipment-model { color: var(--text-muted); }

/* ---------- Proposal card ---------- */
.proposal-card { background: linear-gradient(180deg, #fff, var(--itp-light)); }
.pricing-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}
.pricing-table th, .pricing-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--itp-border);
  text-align: left;
  font-size: 14px;
}
.pricing-table th { background: var(--itp-light); width: 50%; }
.pricing-table .total-row th, .pricing-table .total-row td {
  background: var(--itp-warning-bg);
  font-size: 16px;
  border-top: 2px solid var(--itp-warning-border);
}
.proposal-block {
  background: #fff;
  border: 1px solid var(--itp-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.proposal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.proposal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--itp-border);
}
