:root {
  --wpi-purple: #67256f;
  --wpi-purple-dark: #3e1746;
  --wpi-blue: #4b9fbd;
  --wpi-blue-dark: #25657c;
  --wpi-bg: #f4f2f6;
  --wpi-panel: #ffffff;
  --wpi-panel-soft: #faf8fb;
  --wpi-line: #e3dde7;
  --wpi-text: #25202a;
  --wpi-muted: #6f6674;
  --wpi-success: #16784a;
  --wpi-success-bg: #eaf7f0;
  --wpi-warning: #9a5a00;
  --wpi-warning-bg: #fff6e7;
  --wpi-danger: #a12835;
  --wpi-danger-bg: #fff0f1;
  --wpi-info: #225d77;
  --wpi-info-bg: #edf7fb;
  --wpi-shadow: 0 20px 56px rgba(55, 27, 63, 0.10);
  --wpi-radius: 18px;
  font-family: Inter, Arial, sans-serif;
  color: var(--wpi-text);
  background: var(--wpi-bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 0%, rgba(103, 37, 111, 0.12), transparent 30%),
    radial-gradient(circle at 95% 5%, rgba(75, 159, 189, 0.12), transparent 28%),
    linear-gradient(160deg, #fbfafc 0%, #f2eff5 100%);
}

button, input, textarea, select { font: inherit; }
button { color: inherit; }
a { color: inherit; }

.wpi-shell {
  width: min(1440px, calc(100% - 36px));
  margin: 22px auto 54px;
}

.wpi-topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  min-height: 92px;
  padding: 16px 22px;
  border: 1px solid rgba(227, 221, 231, 0.95);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--wpi-shadow);
  backdrop-filter: blur(12px);
}

.wpi-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 145px;
}

.wpi-brand img {
  display: block;
  width: 142px;
  height: auto;
}

.wpi-heading { min-width: 0; }
.wpi-eyebrow {
  margin: 0 0 4px;
  color: var(--wpi-blue-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.wpi-heading h1 {
  margin: 0;
  color: var(--wpi-purple-dark);
  font-size: clamp(1.45rem, 2.4vw, 2.15rem);
  letter-spacing: -0.03em;
}

.wpi-heading p {
  margin: 6px 0 0;
  color: var(--wpi-muted);
  line-height: 1.45;
}

.wpi-top-actions,
.wpi-actions,
.wpi-toolbar,
.wpi-modal-actions,
.wpi-review-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.wpi-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 0;
  border-radius: 11px;
  padding: 10px 15px;
  font-weight: 750;
  line-height: 1.15;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.wpi-button:hover { transform: translateY(-1px); }
.wpi-button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(75, 159, 189, 0.28);
  outline-offset: 2px;
}

.wpi-button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}


.wpi-button.disabled,
.wpi-button[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: auto;
  box-shadow: none;
  transform: none;
}

.wpi-button.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--wpi-purple), var(--wpi-blue));
  box-shadow: 0 9px 20px rgba(103, 37, 111, 0.18);
}

.wpi-button.secondary {
  color: var(--wpi-purple-dark);
  background: #f2edf4;
  border: 1px solid #dfd5e3;
}

.wpi-button.neutral {
  color: #3f3844;
  background: #f4f4f5;
  border: 1px solid #dedde1;
}

.wpi-button.success {
  color: #fff;
  background: #1b8353;
}

.wpi-button.danger {
  color: #fff;
  background: #ad2f3d;
}

.wpi-delete-action { margin-right: auto; }

.wpi-button.ghost {
  color: var(--wpi-purple-dark);
  background: transparent;
  border: 1px solid var(--wpi-line);
}

.wpi-main { margin-top: 20px; }

.wpi-notice {
  margin: 0 0 18px;
  padding: 13px 15px;
  border-radius: 13px;
  border: 1px solid transparent;
  line-height: 1.5;
}

.wpi-notice.info { color: var(--wpi-info); background: var(--wpi-info-bg); border-color: #c8e4ef; }
.wpi-notice.success { color: var(--wpi-success); background: var(--wpi-success-bg); border-color: #bce2cc; }
.wpi-notice.warning { color: var(--wpi-warning); background: var(--wpi-warning-bg); border-color: #efdaa9; }
.wpi-notice.error { color: var(--wpi-danger); background: var(--wpi-danger-bg); border-color: #efc5ca; }

.wpi-userbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid var(--wpi-line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.86);
}

.wpi-userbar span,
.wpi-stat span,
.wpi-meta-label {
  display: block;
  margin-bottom: 4px;
  color: var(--wpi-muted);
  font-size: 0.75rem;
  font-weight: 650;
}

.wpi-userbar strong { color: var(--wpi-purple-dark); }

.wpi-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.wpi-stat {
  padding: 18px;
  border: 1px solid var(--wpi-line);
  border-radius: var(--wpi-radius);
  background: var(--wpi-panel);
  box-shadow: 0 10px 28px rgba(55, 27, 63, 0.06);
}

.wpi-stat strong {
  display: block;
  color: var(--wpi-purple-dark);
  font-size: clamp(1.65rem, 3vw, 2.3rem);
  line-height: 1;
}

.wpi-stat.pending { border-top: 4px solid #d18b1c; }
.wpi-stat.approved { border-top: 4px solid #2a925f; }
.wpi-stat.rejected { border-top: 4px solid #c33a49; }
.wpi-stat.total { border-top: 4px solid var(--wpi-blue); }

.wpi-panel {
  border: 1px solid var(--wpi-line);
  border-radius: var(--wpi-radius);
  background: var(--wpi-panel);
  box-shadow: var(--wpi-shadow);
  overflow: hidden;
}

.wpi-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--wpi-line);
}

.wpi-panel-header h2 {
  margin: 0 0 4px;
  color: var(--wpi-purple-dark);
  font-size: 1.2rem;
}

.wpi-panel-header p { margin: 0; color: var(--wpi-muted); line-height: 1.45; }

.wpi-filterbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 240px) auto;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--wpi-line);
  background: var(--wpi-panel-soft);
}

.wpi-field { display: grid; gap: 6px; }
.wpi-field > span,
.wpi-form-group > label {
  color: #3f3644;
  font-size: 0.84rem;
  font-weight: 750;
}

input, textarea, select {
  width: 100%;
  border: 1px solid #d7d0da;
  border-radius: 10px;
  background: #fff;
  color: var(--wpi-text);
  padding: 10px 12px;
}

textarea { min-height: 92px; resize: vertical; line-height: 1.45; }

.wpi-table-wrap { overflow-x: auto; }

.wpi-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.wpi-table th,
.wpi-table td {
  padding: 13px 14px;
  border-bottom: 1px solid #eee9f0;
  text-align: left;
  vertical-align: middle;
}

.wpi-table th {
  color: var(--wpi-muted);
  background: #fbfafc;
  font-size: 0.73rem;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.wpi-table tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}

.wpi-table tbody tr:hover { background: #fbf8fc; }
.wpi-table tbody tr:last-child td { border-bottom: 0; }

.wpi-primary-cell strong { display: block; color: var(--wpi-purple-dark); }
.wpi-primary-cell small { display: block; margin-top: 3px; color: var(--wpi-muted); }

.wpi-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}

.wpi-status.pending { color: #8b5700; background: #fff2d8; }
.wpi-status.approved { color: #176841; background: #e5f6ec; }
.wpi-status.rejected { color: #9d2936; background: #fde8eb; }
.wpi-status.draft { color: #4b5960; background: #edf1f3; }

.wpi-empty {
  padding: 44px 20px;
  color: var(--wpi-muted);
  text-align: center;
}

.wpi-empty strong {
  display: block;
  margin-bottom: 5px;
  color: var(--wpi-purple-dark);
  font-size: 1.05rem;
}

.wpi-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  color: var(--wpi-muted);
}

.wpi-spinner {
  width: 24px;
  height: 24px;
  margin-right: 10px;
  border: 3px solid #e6dfe9;
  border-top-color: var(--wpi-purple);
  border-radius: 50%;
  animation: wpi-spin 0.9s linear infinite;
}

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

.wpi-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(31, 20, 36, 0.62);
  backdrop-filter: blur(4px);
}

.wpi-modal-dialog {
  width: min(1120px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(21, 11, 25, 0.34);
}

.wpi-modal-dialog.compact { width: min(900px, 100%); }
.wpi-modal-dialog.settings-dialog { width: min(620px, 100%); }

.wpi-modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--wpi-line);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(10px);
}

.wpi-modal-header h2 { margin: 0 0 4px; color: var(--wpi-purple-dark); }
.wpi-modal-header p { margin: 0; color: var(--wpi-muted); }

.wpi-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 0;
  border-radius: 50%;
  background: #f1edf3;
  color: var(--wpi-purple-dark);
  font-size: 1.45rem;
  cursor: pointer;
}

.wpi-modal-body { padding: 22px; }

.wpi-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--wpi-line);
}

.wpi-section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.wpi-section h3 { margin: 0 0 14px; color: var(--wpi-purple-dark); font-size: 1rem; }

.wpi-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.wpi-form-group { display: grid; gap: 6px; }
.wpi-form-group.full { grid-column: 1 / -1; }
.wpi-form-group .help { color: var(--wpi-muted); font-size: 0.77rem; line-height: 1.4; }
.wpi-settings-form { display: grid; gap: 18px; }
.wpi-loading.compact { min-height: 110px; }
.wpi-profile-note { display: block; margin-top: 5px; color: var(--wpi-blue-dark); font-size: 0.72rem; }
.wpi-profile-status { display: inline-flex; align-items: center; margin-top: 6px; padding: 3px 8px; border-radius: 999px; font-size: 0.68rem; font-weight: 700; }
.wpi-profile-status.active { color: #17633a; background: #e8f7ee; }
.wpi-profile-status.pending { color: #7a4d00; background: #fff3d6; }

.wpi-review-box {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid #ddcfdf;
  border-radius: 14px;
  background: #fbf7fc;
}

.wpi-review-box h3 { margin: 0; color: var(--wpi-purple-dark); }

.wpi-history {
  display: grid;
  gap: 9px;
}

.wpi-history-item {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--wpi-line);
  border-radius: 10px;
  background: #fff;
}

.wpi-history-item time { color: var(--wpi-muted); font-size: 0.78rem; }
.wpi-history-item strong { display: block; margin-bottom: 2px; color: var(--wpi-purple-dark); }
.wpi-history-item p { margin: 0; color: var(--wpi-muted); font-size: 0.85rem; line-height: 1.4; }

.wpi-profile-list { display: grid; gap: 10px; }

.wpi-profile-row {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(170px, 220px) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--wpi-line);
  border-radius: 12px;
  background: #fff;
}

.wpi-profile-row strong { display: block; color: var(--wpi-purple-dark); }
.wpi-profile-row small { display: block; margin-top: 3px; color: var(--wpi-muted); }

.wpi-form-page {
  width: min(1050px, calc(100% - 32px));
  margin: 22px auto 54px;
}

.wpi-form-card {
  padding: clamp(20px, 4vw, 38px);
  border: 1px solid var(--wpi-line);
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--wpi-shadow);
}

.wpi-question {
  padding: 14px 0 17px;
  border-bottom: 1px solid #eee9f0;
}

.wpi-question > label { display: block; margin-bottom: 8px; font-weight: 750; color: #3f3644; }
.wpi-hint { display: block; margin-top: 4px; color: var(--wpi-muted); font-size: 0.78rem; font-weight: 500; line-height: 1.45; }

.wpi-radio-row { display: flex; gap: 9px; flex-wrap: wrap; }

.wpi-radio-card {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: auto;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid #d8d1dc;
  border-radius: 999px;
  background: #fff;
  font-weight: 650;
  cursor: pointer;
}

.wpi-radio-card:has(input:checked) {
  border-color: var(--wpi-blue);
  background: #edf7fb;
  color: var(--wpi-blue-dark);
}

.wpi-radio-card input { width: auto; margin: 0; accent-color: var(--wpi-purple); }

.hidden { display: none !important; }
.required { color: var(--wpi-danger); }

@media (max-width: 980px) {
  .wpi-topbar { grid-template-columns: auto 1fr; }
  .wpi-top-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .wpi-userbar, .wpi-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wpi-filterbar { grid-template-columns: 1fr 220px; }
  .wpi-filterbar .wpi-button { grid-column: 1 / -1; justify-self: start; }
  .wpi-profile-row { grid-template-columns: 1fr 180px; }
}

@media (max-width: 700px) {
  .wpi-shell, .wpi-form-page { width: min(100% - 18px, 1440px); margin-top: 10px; }
  .wpi-topbar { grid-template-columns: 1fr; padding: 16px; border-radius: 16px; }
  .wpi-brand { justify-content: flex-start; }
  .wpi-heading h1 { font-size: 1.55rem; }
  .wpi-top-actions { grid-column: auto; justify-content: flex-start; }
  .wpi-top-actions .wpi-button { flex: 1 1 180px; }
  .wpi-userbar, .wpi-stats { grid-template-columns: 1fr; }
  .wpi-panel-header { display: block; }
  .wpi-panel-header .wpi-actions { margin-top: 12px; }
  .wpi-filterbar { grid-template-columns: 1fr; padding: 14px; }
  .wpi-filterbar .wpi-button { grid-column: auto; }
  .wpi-modal { padding: 8px; }
  .wpi-modal-dialog { max-height: calc(100vh - 16px); border-radius: 16px; }
  .wpi-modal-header, .wpi-modal-body { padding: 16px; }
  .wpi-form-grid { grid-template-columns: 1fr; }
  .wpi-form-group.full { grid-column: auto; }
  .wpi-modal-actions .wpi-button, .wpi-review-actions .wpi-button { flex: 1 1 100%; }
  .wpi-delete-action { margin-right: 0; }
  .wpi-history-item { grid-template-columns: 1fr; }
  .wpi-profile-row { grid-template-columns: 1fr; }
}

@media print {
  body { background: #fff; }
  .wpi-topbar, .wpi-filterbar, .wpi-actions, .wpi-review-box, .wpi-close { display: none !important; }
  .wpi-shell, .wpi-form-page { width: 100%; margin: 0; }
  .wpi-panel, .wpi-form-card { box-shadow: none; border: 0; }
}
