.spp-portal,
.spp-admin-wrap {
  --spp-ink: var(--wp--preset--color--contrast, currentColor);
  --spp-muted: color-mix(in srgb, currentColor 68%, transparent);
  --spp-line: color-mix(in srgb, currentColor 22%, transparent);
  --spp-field: color-mix(in srgb, currentColor 5%, transparent);
  --spp-surface: var(--wp--preset--color--base, Canvas);
  --spp-accent: var(--wp--preset--color--primary, #2271b1);
  color: var(--spp-ink);
}

.spp-admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}

.spp-admin-stack {
  display: grid;
  gap: 20px;
}

.spp-settings,
.spp-panel,
.spp-card {
  background: var(--spp-surface);
  border: 1px solid var(--spp-line);
  border-radius: 6px;
}

.spp-settings {
  padding: 18px;
}

.spp-admin-notice {
  padding: 16px;
}

.spp-admin-notice p {
  margin: 0;
}

.spp-settings label {
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
  font-weight: 600;
}

.spp-settings input,
.spp-settings select,
.spp-settings textarea,
.spp-input,
.spp-select {
  min-height: 38px;
  border: 1px solid var(--spp-line);
  border-radius: 6px;
  background: var(--spp-surface);
  color: inherit;
  font: inherit;
  padding: 7px 10px;
}

.spp-settings textarea {
  min-height: 72px;
}

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

.spp-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
}

.spp-subtitle {
  margin: 4px 0 0;
  color: var(--spp-muted);
}

.spp-tabs,
.spp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.spp-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--spp-line);
  border-radius: 6px;
  background: var(--spp-surface);
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 7px 12px;
}

.spp-button-primary {
  background: var(--spp-accent);
  border-color: var(--spp-accent);
  color: #fff;
}

.spp-button-danger {
  border-color: #fecaca;
  color: #b91c1c;
}

.spp-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.spp-panel {
  overflow: hidden;
}

.spp-table {
  width: 100%;
  border-collapse: collapse;
}

.spp-table th {
  background: var(--spp-field);
  color: var(--spp-muted);
  font-size: 12px;
  letter-spacing: 0;
  text-align: left;
  text-transform: uppercase;
}

.spp-table th,
.spp-table td {
  border-bottom: 1px solid var(--spp-line);
  padding: 12px;
  vertical-align: middle;
}

.spp-table tr:last-child td {
  border-bottom: 0;
}

.spp-badge {
  display: inline-flex;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 9px;
}

.spp-badge.RUNNING {
  background: #d1fae5;
  color: #065f46;
}

.spp-badge.STOPPED,
.spp-badge.DELETED {
  background: #f1f5f9;
  color: #475569;
}

.spp-badge.EXPIRED {
  background: #ffedd5;
  color: #9a3412;
}

.spp-badge.PROVISIONING,
.spp-badge.DELETING {
  background: #fef3c7;
  color: #92400e;
}

.spp-badge.OWNER {
  background: #dbeafe;
  color: #1e40af;
}

.spp-badge.SHARED {
  background: #ede9fe;
  color: #5b21b6;
}

.spp-badge.ADMIN {
  background: #e0f2fe;
  color: #075985;
}

.spp-badge.FAILED,
.spp-error {
  background: #fee2e2;
  color: #991b1b;
}

.spp-warning {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  color: #9a3412;
  margin-bottom: 16px;
  padding: 10px 12px;
}

.spp-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.spp-card {
  padding: 16px;
}

.spp-card h3 {
  margin: 0 0 8px;
}

.spp-card p {
  color: var(--spp-muted);
  margin: 0 0 12px;
}

.spp-quota {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 8px;
  color: var(--spp-muted);
  font-size: 13px;
}

.spp-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  color: var(--spp-muted);
  font-size: 13px;
}

.spp-meta strong {
  color: var(--spp-ink);
  display: block;
  font-size: 14px;
}

.spp-form {
  display: grid;
  max-width: 640px;
  gap: 14px;
}

.spp-prolong-form {
  border-top: 1px solid var(--spp-line);
  display: grid;
  gap: 12px;
  margin-top: 18px;
  max-width: 520px;
  padding-top: 16px;
}

.spp-prolong-form h3 {
  margin: 0;
}

.spp-share-panel {
  border-top: 1px solid var(--spp-line);
  display: grid;
  gap: 12px;
  margin-top: 18px;
  max-width: 640px;
  padding-top: 16px;
}

.spp-share-panel h3,
.spp-share-panel p {
  margin: 0;
}

.spp-share-list {
  display: grid;
  gap: 8px;
}

.spp-share-row {
  align-items: center;
  border: 1px solid var(--spp-line);
  border-radius: 6px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 10px;
}

.spp-share-row small {
  color: var(--spp-muted);
  display: block;
  margin-top: 2px;
}

.spp-share-form {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.spp-form label,
.spp-prolong-form label,
.spp-share-form label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.spp-check {
  align-items: center;
  display: flex !important;
  gap: 8px;
}

.spp-check input {
  margin: 0;
}

.spp-error {
  border-radius: 6px;
  padding: 10px 12px;
}

.spp-user-access {
  margin-top: 20px;
}

.spp-template-admin {
  margin-top: 20px;
}

.spp-template-admin h3 {
  margin: 18px 0 10px;
}

.spp-section-header {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.spp-section-header h2 {
  margin: 0 0 4px;
}

.spp-user-search {
  align-items: center;
  display: flex;
  gap: 8px;
}

.spp-user-search input {
  min-height: 32px;
}

.spp-user-access-table td {
  vertical-align: top;
}

.spp-user-login {
  color: var(--spp-muted);
  display: block;
  margin-top: 4px;
}

.spp-permission-groups {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.spp-permission-groups fieldset {
  border: 1px solid var(--spp-line);
  border-radius: 6px;
  margin: 0;
  padding: 10px;
}

.spp-permission-groups legend {
  font-weight: 700;
  padding: 0 4px;
}

.spp-permission-groups label {
  align-items: flex-start;
  display: flex !important;
  font-weight: 400;
  gap: 6px;
  margin: 8px 0 0;
}

.spp-permission-groups input[type="checkbox"] {
  margin: 2px 0 0;
  min-height: auto;
  padding: 0;
}

.spp-template-list,
.spp-pve-template-grid {
  display: grid;
  gap: 12px;
}

.spp-pve-template-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.spp-template-row,
.spp-pve-template {
  border: 1px solid var(--spp-line);
  border-radius: 6px;
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 14px;
}

.spp-template-row-head {
  align-items: flex-start;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.spp-template-row-head strong,
.spp-template-row-head span {
  display: block;
}

.spp-template-row-head span {
  color: var(--spp-muted);
  font-size: 13px;
  margin-top: 2px;
}

.spp-template-fields {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.spp-template-fields label {
  margin: 0;
}

.spp-template-description {
  grid-column: 1 / -1;
}

.spp-template-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 960px) {
  .spp-admin-grid,
  .spp-grid,
  .spp-permission-groups,
  .spp-pve-template-grid,
  .spp-template-fields,
  .spp-share-form {
    grid-template-columns: 1fr;
  }
}
