:root {
  --forest-950: #0b2018;
  --forest-900: #0f2a1f;
  --forest-800: #163a2a;
  --forest-700: #1f4d38;
  --forest-600: #2f6f4f;
  --amber-500: #c07a3e;
  --amber-400: #d59454;
  --ivory-100: #f6f3ec;
  --ivory-300: #d9d3c4;
  --danger: #e0645a;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ivory-100);
  background: radial-gradient(circle at 20% 20%, var(--forest-800), var(--forest-950) 60%);
  position: relative;
  overflow-x: hidden;
}

.bg-decor {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(600px 400px at 85% 15%, rgba(192, 122, 62, 0.12), transparent 60%),
    radial-gradient(500px 500px at 10% 90%, rgba(47, 111, 79, 0.25), transparent 60%);
}

.topbar {
  position: relative;
  z-index: 1;
  padding: 28px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.user-menu[hidden] {
  display: none;
}

.current-user-name {
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

body:has(#picker-view:not([hidden])) .topbar {
  flex-wrap: wrap;
  gap: 16px 24px;
}

body:has(#picker-view:not([hidden])) .center-stage {
  align-items: center;
  justify-content: flex-start;
}

.picker-section {
  width: 100%;
  max-width: 960px;
  min-width: 0;
  padding: 20px 0;
}

.customer-app-groups {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 8px;
}

.brand-mark {
  font-size: 20px;
  color: var(--ivory-100);
}

.brand-mark-accent {
  font-size: 20px;
  color: var(--amber-400);
}

.brand-sub {
  margin-left: 10px;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.03em;
  color: var(--ivory-300);
  text-transform: uppercase;
}

.center-stage {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.registration-section {
  width: 100%;
  max-width: 580px;
  padding: 24px 0;
}

.registration-section .card-title {
  line-height: 1.25;
  margin-bottom: 16px;
}

.registration-names {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.catalog-section {
  width: 100%;
  max-width: 960px;
  margin-top: 40px;
  padding: 24px 0;
  border-top: 1px solid rgba(217, 211, 196, 0.16);
}

.app-choice {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
}

.app-choice .app-tile {
  width: 100%;
  flex: 1;
}

.app-status {
  font-size: 12px;
  color: var(--ivory-300);
  overflow-wrap: anywhere;
}

.implementation-select {
  width: 100%;
  min-width: 0;
  padding: 8px 4px;
  border: 1px solid rgba(217, 211, 196, 0.3);
  border-radius: 4px;
  background: var(--forest-950);
  color: var(--ivory-100);
}

.app-tile-locked .app-icon {
  filter: grayscale(1);
}

.app-tile-locked:disabled {
  opacity: 0.6;
  background: rgba(11, 32, 24, 0.3);
  border-color: rgba(217, 211, 196, 0.12);
}

.field input[readonly] {
  color: var(--ivory-300);
}

@media (max-width: 480px) {
  .registration-names { grid-template-columns: minmax(0, 1fr); gap: 0; }
}

.card {
  width: 100%;
  max-width: 380px;
  background: rgba(15, 42, 31, 0.75);
  border: 1px solid rgba(217, 211, 196, 0.12);
  border-radius: 16px;
  padding: 40px 36px;
  backdrop-filter: blur(6px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.card-wide {
  max-width: 620px;
}

.card-title {
  margin: 0 0 4px;
  font-size: 26px;
  font-weight: 600;
}

.card-subtitle {
  margin: 0 0 28px;
  color: var(--ivory-300);
  font-size: 14px;
}

.field {
  display: block;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--ivory-300);
}

.field span {
  display: block;
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 8px;
  border: 1px solid rgba(217, 211, 196, 0.2);
  background: rgba(11, 32, 24, 0.6);
  color: var(--ivory-100);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus {
  border-color: var(--amber-500);
  box-shadow: 0 0 0 3px rgba(192, 122, 62, 0.2);
}

.btn-primary {
  width: 100%;
  padding: 12px 16px;
  margin-top: 8px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--amber-400), var(--amber-500));
  color: #241206;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.btn-primary:hover {
  box-shadow: 0 8px 20px rgba(192, 122, 62, 0.3);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: default;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 16px;
  color: var(--ivory-300);
  font-size: 12px;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(217, 211, 196, 0.16);
}

.external-provider-list {
  display: grid;
  gap: 10px;
}

.btn-provider {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid rgba(217, 211, 196, 0.25);
  border-radius: 8px;
  background: rgba(246, 243, 236, 0.08);
  color: var(--ivory-100);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.btn-provider:hover {
  background: rgba(246, 243, 236, 0.14);
  border-color: rgba(217, 211, 196, 0.4);
}

.provider-mark {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: var(--ivory-100);
  color: var(--forest-950);
  font-size: 13px;
  font-weight: 700;
}

.btn-link {
  display: inline-block;
  margin-top: 24px;
  background: none;
  border: none;
  color: var(--ivory-300);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

.btn-link:hover {
  color: var(--ivory-100);
}

.btn-link[hidden] {
  display: none;
}

.error-text {
  margin: -6px 0 16px;
  color: var(--danger);
  font-size: 13px;
}

.hint-text {
  color: var(--ivory-300);
  font-size: 14px;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(120px, 100%), 1fr));
  gap: 18px;
  margin-bottom: 8px;
}

.customer-app-group {
  min-width: 0;
  padding: 24px;
  border: 1px solid rgba(217, 211, 196, 0.16);
  border-radius: 8px;
  background: rgba(15, 42, 31, 0.75);
}

.customer-app-title {
  margin: 0 0 12px;
  color: var(--ivory-100);
  font-size: 18px;
  overflow-wrap: anywhere;
}

.app-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 18px 10px;
  border-radius: 12px;
  border: 1px solid rgba(217, 211, 196, 0.12);
  background: rgba(11, 32, 24, 0.45);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.app-tile:hover {
  transform: translateY(-3px);
  background: rgba(31, 77, 56, 0.55);
  border-color: rgba(192, 122, 62, 0.4);
}

.app-tile:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

.app-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
}

.app-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-icon .library-icon {
  width: 68%;
  height: 68%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-name {
  font-size: 13px;
  text-align: center;
  color: var(--ivory-100);
  line-height: 1.3;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.page-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: var(--ivory-300);
}

.admin-stage {
  position: relative;
  z-index: 1;
  flex: 1;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 0 40px 60px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.admin-nav {
  display: flex;
  width: fit-content;
  max-width: 100%;
  gap: 4px;
  padding: 5px;
  border: 1px solid rgba(217, 211, 196, 0.18);
  border-radius: 8px;
  background: rgba(11, 32, 24, 0.72);
}

.admin-tab {
  min-height: 40px;
  padding: 9px 18px;
  border: 0;
  background: transparent;
  color: var(--ivory-300);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 5px;
  transition: color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.admin-tab.is-active {
  color: #241206;
  background: var(--amber-400);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.admin-tab:not(.is-active):hover {
  color: var(--ivory-100);
  background: rgba(246, 243, 236, 0.08);
}

.admin-tab:focus-visible,
.table-action:focus-visible,
.admin-form .btn-link:focus-visible,
.topbar .btn-link:focus-visible {
  outline: 2px solid var(--amber-400);
  outline-offset: 2px;
}

.admin-section[hidden] {
  display: none;
}

.admin-filter {
  width: min(100%, 360px);
  margin-bottom: 14px;
  padding: 9px 12px;
  border: 1px solid rgba(217, 211, 196, 0.2);
  border-radius: 8px;
  background: rgba(11, 32, 24, 0.6);
  color: var(--ivory-100);
  font-size: 14px;
}

.admin-card {
  background: rgba(15, 42, 31, 0.75);
  border: 1px solid rgba(217, 211, 196, 0.12);
  border-radius: 16px;
  padding: 28px 32px;
}

.admin-card h2 {
  margin: 0 0 16px;
  font-size: 18px;
}

.admin-card h3 {
  margin: 22px 0 12px;
  font-size: 15px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-bottom: 20px;
}

.admin-table th {
  text-align: left;
  color: var(--ivory-300);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(217, 211, 196, 0.15);
}

.admin-table td {
  padding: 10px;
  border-bottom: 1px solid rgba(217, 211, 196, 0.08);
  vertical-align: middle;
}

.admin-table .table-empty {
  padding: 22px 10px;
  color: var(--ivory-300);
  text-align: center;
}

.admin-table a {
  color: var(--amber-400);
  font-weight: 600;
  text-decoration-color: rgba(213, 148, 84, 0.45);
  text-underline-offset: 3px;
}

.admin-table a:hover {
  color: var(--ivory-100);
  text-decoration-color: currentColor;
}

.table-action {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin: 3px 6px 3px 0;
  padding: 5px 9px;
  border: 1px solid rgba(217, 211, 196, 0.2);
  border-radius: 5px;
  background: rgba(246, 243, 236, 0.05);
  color: var(--ivory-100);
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
}

.table-action:hover {
  border-color: rgba(213, 148, 84, 0.65);
  background: rgba(213, 148, 84, 0.12);
  color: var(--ivory-100);
}

.topbar .btn-link,
.admin-form .btn-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  margin: 0;
  padding: 7px 12px;
  border: 1px solid rgba(217, 211, 196, 0.2);
  border-radius: 5px;
  color: var(--ivory-100);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}

.topbar .btn-link:hover,
.admin-form .btn-link:hover {
  border-color: rgba(213, 148, 84, 0.65);
  background: rgba(213, 148, 84, 0.12);
}

.admin-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.admin-form input,
.admin-form select {
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid rgba(217, 211, 196, 0.2);
  background: rgba(11, 32, 24, 0.6);
  color: var(--ivory-100);
  font-size: 14px;
}

.admin-form input:focus,
.admin-form select:focus,
.admin-filter:focus {
  outline: 2px solid rgba(213, 148, 84, 0.7);
  outline-offset: 1px;
}

.admin-form input[type="color"] {
  padding: 2px;
  width: 48px;
  height: 38px;
}

.icon-library-field {
  flex: 1 0 100%;
  min-width: 0;
  margin: 4px 0;
  padding: 12px;
  border: 1px solid rgba(217, 211, 196, 0.17);
  border-radius: 6px;
}

.icon-library-field legend {
  padding: 0 6px;
  color: var(--ivory-300);
  font-size: 13px;
}

.icon-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 7px;
}

.icon-library-category {
  grid-column: 1 / -1;
  margin: 10px 0 0;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(217, 211, 196, 0.12);
  color: var(--amber-400);
  font-size: 12px;
  font-weight: 600;
}

.icon-library-category:first-child {
  margin-top: 0;
}

.icon-choice {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 5px;
  min-height: 76px;
  padding: 8px 4px;
  border: 1px solid rgba(217, 211, 196, 0.12);
  border-radius: 5px;
  color: var(--ivory-300);
  cursor: pointer;
  text-align: center;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.icon-choice:hover,
.icon-choice.is-selected {
  border-color: var(--amber-400);
  background: rgba(213, 148, 84, 0.12);
  color: var(--ivory-100);
}

.icon-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.icon-choice input:focus-visible + .icon-choice-preview {
  outline: 2px solid var(--amber-400);
  outline-offset: 3px;
}

.icon-choice-preview {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: rgba(11, 32, 24, 0.78);
  color: var(--ivory-100);
  font-weight: 700;
}

.icon-choice-preview img,
.icon-choice-preview .library-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.icon-choice-preview .library-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-choice-label {
  max-width: 100%;
  font-size: 11px;
  line-height: 1.2;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ivory-300);
}

.btn-compact {
  width: auto;
  margin-top: 0;
  padding: 9px 18px;
}

@media (max-width: 700px) {
  .admin-stage {
    padding: 0 16px 40px;
  }

  .admin-card {
    padding: 20px 16px;
    overflow-x: auto;
  }

  .admin-nav {
    overflow-x: auto;
  }

  .admin-tab {
    white-space: nowrap;
    padding-inline: 12px;
  }
}
