:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #d9dde5;
  --text: #17202e;
  --muted: #657083;
  --blue: #1d5fd0;
  --green: #12715b;
  --red: #b42318;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

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

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 22px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand-link:hover h1 {
  color: var(--blue);
}

.brand-icon {
  width: 30px;
  height: 30px;
  border-radius: 7px;
}

h2 {
  font-size: 16px;
}

.app-header p,
.panel-heading p,
.meta,
.message,
.empty-state {
  color: var(--muted);
}

main {
  padding: 14px 24px 28px;
}

.tabs {
  display: inline-flex;
  padding: 3px;
  background: #eef1f5;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tab,
button,
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 7px 12px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}

.tab.active {
  background: #ffffff;
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.primary {
  background: var(--blue);
  color: #ffffff;
}

.secondary,
.file-button {
  background: #ffffff;
  border-color: var(--line);
}

.danger {
  color: var(--red);
}

.compact-action {
  min-width: 32px;
  padding-inline: 8px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.portal-layout {
  max-width: 1440px;
  margin: 0 auto;
}

.portal-content {
  display: grid;
  gap: 16px;
}

.env-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 1px 0 3px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.env-tab {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 104px;
  min-height: 36px;
  border-color: var(--line);
  padding: 7px 10px 7px 12px;
  background: #ffffff;
  box-shadow: var(--shadow);
  font-weight: 600;
  text-transform: capitalize;
}

.env-tab.active {
  background: #eef4ff;
  border-color: #8fb5ff;
  color: #174ea6;
  box-shadow: 0 0 0 1px #8fb5ff;
}

.env-tab strong {
  min-width: 26px;
  border-radius: 999px;
  padding: 1px 7px;
  background: #eef1f5;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  text-transform: none;
}

.env-tab.active strong {
  background: #ffffff;
  color: #174ea6;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 220px;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  background: #ffffff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px;
}

.resource-groups {
  display: grid;
  gap: 24px;
}

.resource-group {
  display: grid;
  gap: 10px;
}

.group-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.group-heading h2 {
  font-size: 15px;
  text-transform: capitalize;
}

.group-count {
  display: inline-flex;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.group-heading span {
  color: var(--muted);
  font-size: 12px;
}

.link-button {
  min-height: auto;
  padding: 3px 0;
  color: var(--blue);
  font-size: 13px;
}

.card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.card {
  display: grid;
  gap: 5px;
  min-height: 86px;
  padding: 10px 12px 9px;
  color: inherit;
  text-decoration: none;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.card:hover {
  border-color: #9db9f8;
  box-shadow: 0 3px 10px rgba(16, 24, 40, 0.12);
  transform: translateY(-1px);
}

.card:focus-visible {
  outline: 2px solid #8fb5ff;
  outline-offset: 2px;
  border-color: #bdd2ff;
  box-shadow: 0 2px 8px rgba(29, 95, 208, 0.12);
}

.card-title {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
}

.card-title:has(.badge) {
  grid-template-columns: 30px minmax(0, 1fr) auto;
}

.card-title > div {
  min-width: 0;
}

.card-title .badge {
  justify-self: end;
}

.card h3 {
  overflow: hidden;
  margin: 0;
  font-size: 14px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: #eef4ff;
  color: #174ea6;
  font-size: 11px;
  font-weight: 800;
}

.card-icon img {
  display: block;
  width: 18px;
  height: 18px;
}

.image-icon {
  background: #ffffff;
  border: 1px solid var(--line);
}

.table-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.table-name .card-icon {
  flex-basis: 24px;
  width: 24px;
  height: 24px;
}

.table-name .card-icon img {
  width: 16px;
  height: 16px;
}

.card-description {
  display: -webkit-box;
  overflow: hidden;
  min-height: 17px;
  color: #344054;
  font-size: 13px;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.badge-row,
.tags,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge,
.tag {
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 12px;
  background: #eef4ff;
  color: #174ea6;
}

.badge.env-prod {
  background: #fff1f0;
  color: #b42318;
}

.badge.env-uat {
  background: #ecfdf3;
  color: var(--green);
}

.badge.env-shared {
  background: #f4f3ff;
  color: #5b21b6;
}

.badge.env-external {
  background: #fff7ed;
  color: #c2410c;
}

.tag {
  padding: 1px 6px;
  background: #f4f5f7;
  color: #657083;
  font-size: 11px;
}

.manage-layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 18px;
}

.admin-login {
  display: grid;
  max-width: 420px;
  gap: 14px;
}

.manage-locked .manage-layout {
  display: none;
}

.manage-unlocked #adminLogin {
  display: none;
}

.panel {
  padding: 16px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

#resourceForm {
  align-content: start;
  gap: 12px;
}

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

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.hidden {
  display: none;
}

@media (max-width: 860px) {
  .app-header,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar,
  .manage-layout {
    grid-template-columns: 1fr;
  }

  main {
    padding: 16px;
  }
}
