:root {
  --portal-ink: #1b2330;
  --portal-muted: #6b7280;
  --portal-border: #e7eaf0;
  --portal-border-strong: #d3d9e3;
  --portal-bg: #eef1f6;
  --portal-surface: #ffffff;
  --portal-accent: #0f766e;
  --portal-action: #2f5fa6;
  --portal-action-dark: #244c86;
  --portal-warning: #9a5b13;
  --portal-danger: #b42318;
  --portal-success: #067647;
  --portal-radius: 12px;
  --portal-radius-sm: 9px;
  --portal-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 18px rgba(16, 24, 40, .06);
  --portal-shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
}

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 15px;
  }
}

body {
  min-height: 100vh;
  color: var(--portal-ink);
  background: var(--portal-bg);
  font-family: "Segoe UI", system-ui, -apple-system, "Roboto", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.portal-shell {
  max-width: 1200px;
}

/* Navigation */
.portal-nav {
  background: linear-gradient(180deg, #20375a 0%, #1a2c49 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06), 0 2px 14px rgba(13, 22, 38, .18);
  padding-top: .6rem;
  padding-bottom: .6rem;
}

.portal-nav .navbar-brand,
.portal-nav .nav-link {
  color: #eaf0f8;
}

.portal-brand {
  font-weight: 700;
  letter-spacing: .2px;
}

.portal-nav .nav-link {
  font-weight: 500;
  border-radius: 8px;
  padding: .4rem .8rem;
  transition: background-color .15s ease, color .15s ease;
}

.portal-nav .nav-link:hover,
.portal-nav .nav-link:focus {
  color: #fff;
  background: rgba(255, 255, 255, .10);
}

/* Layout */
.portal-main {
  padding-top: 30px;
  padding-bottom: 48px;
}

.portal-footer {
  color: var(--portal-muted);
  padding: 20px 0 30px;
  font-size: .85rem;
}

/* Headings */
.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -.01em;
  margin-bottom: 4px;
}

.page-kicker {
  color: var(--portal-muted);
  margin-bottom: 22px;
}

/* Cards / panels */
.portal-panel {
  background: var(--portal-surface);
  border: 1px solid var(--portal-border);
  border-radius: var(--portal-radius);
  padding: 22px 24px;
  box-shadow: var(--portal-shadow);
}

/* Metric tiles */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
}

.metric {
  position: relative;
  overflow: hidden;
  background: var(--portal-surface);
  border: 1px solid var(--portal-border);
  border-radius: var(--portal-radius);
  padding: 18px 20px;
  min-height: 104px;
  box-shadow: var(--portal-shadow);
}

.metric::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--portal-action);
}

.metric-label {
  color: var(--portal-muted);
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
}

/* Tables / grids */
.table-wrap {
  overflow-x: auto;
}

.portal-table {
  background: var(--portal-surface);
  border: 1px solid var(--portal-border);
  border-radius: var(--portal-radius);
  box-shadow: var(--portal-shadow);
  overflow: hidden;
}

.portal-table table,
.table {
  margin-bottom: 0;
  color: var(--portal-ink);
}

.portal-table thead th,
.table thead th {
  background: #f7f8fb;
  color: var(--portal-muted);
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--portal-border-strong);
  border-top: 0;
  padding: .75rem 1rem;
  white-space: nowrap;
}

.portal-table tbody td,
.table tbody td {
  padding: .85rem 1rem;
  border-top: 1px solid var(--portal-border);
  vertical-align: middle;
}

.portal-table tbody tr:first-child td {
  border-top: 0;
}

.portal-table tbody tr,
.table tbody tr {
  transition: background-color .12s ease;
}

.portal-table tbody tr:hover,
.table.table-hover tbody tr:hover {
  background: #f6f9fc;
}

code {
  background: #eef1f8;
  color: #243b63;
  padding: .14rem .42rem;
  border-radius: 6px;
  font-size: .85em;
}

/* Badges */
.badge-soft {
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  font-size: .78rem;
  font-weight: 600;
  padding: .28rem .7rem;
  line-height: 1;
}

.badge-active {
  background: #e7f6f0;
  color: var(--portal-success);
}

.badge-warning {
  background: #fdf1dd;
  color: var(--portal-warning);
}

.badge-danger {
  background: #fdecea;
  color: var(--portal-danger);
}

.badge-info {
  background: #eaf1fb;
  color: var(--portal-action-dark);
}

/* Application cards */
.app-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 22px;
  transition: border-color .15s ease, box-shadow .15s ease, transform .06s ease;
}

.app-card:hover {
  border-color: var(--portal-border-strong);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 10px 26px rgba(16, 24, 40, .09);
  transform: translateY(-1px);
}

.app-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-icon {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--portal-action) 0%, var(--portal-accent) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 2px 6px rgba(15, 118, 110, .25);
}

.app-name {
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1.25;
  margin-bottom: 5px;
  word-break: break-word;
}

.app-desc {
  color: var(--portal-muted);
  font-size: .9rem;
  line-height: 1.5;
  margin: 0;
}

.app-desc.is-empty {
  font-style: italic;
  opacity: .75;
}

/* Bootstrap helper so a long name/version truncates instead of pushing the icon. */
.min-w-0 {
  min-width: 0;
}

/* Forms */
.form-label {
  font-weight: 600;
  font-size: .82rem;
  color: #374151;
  margin-bottom: .3rem;
}

.form-control,
.form-select {
  border: 1px solid var(--portal-border-strong);
  border-radius: var(--portal-radius-sm);
  padding: .55rem .75rem;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--portal-action);
  box-shadow: 0 0 0 3px rgba(47, 95, 166, .16);
}

.form-text {
  color: var(--portal-muted);
  font-size: .8rem;
}

.form-check-input:checked {
  background-color: var(--portal-action);
  border-color: var(--portal-action);
}

.form-check-input:focus {
  border-color: var(--portal-action);
  box-shadow: 0 0 0 3px rgba(47, 95, 166, .16);
}

/* Buttons */
.btn {
  border-radius: var(--portal-radius-sm);
  font-weight: 600;
  padding: .5rem 1.05rem;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .02s ease;
}

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

.btn-primary {
  background: var(--portal-action);
  border-color: var(--portal-action);
  box-shadow: 0 1px 2px rgba(36, 76, 134, .25);
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--portal-action-dark);
  border-color: var(--portal-action-dark);
}

.btn-outline-secondary {
  border-color: var(--portal-border-strong);
  color: #3a4453;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  background: #f2f4f8;
  color: var(--portal-ink);
  border-color: var(--portal-border-strong);
}

.btn-outline-light {
  border-color: rgba(255, 255, 255, .55);
}

.btn-sm {
  padding: .35rem .75rem;
  font-size: .85rem;
}

/* Auth pages */
.auth-panel {
  max-width: 460px;
  margin: 30px auto;
}

.auth-panel .page-title {
  font-size: 1.5rem;
}

.password-toggle {
  min-width: 64px;
}

/* Reserve stable space for the verification widget so buttons do not jump while it loads. */
.turnstile-wrap {
  min-height: 65px;
}

.validation-summary-errors ul {
  margin-bottom: 0;
  padding-left: 1.1rem;
}

/* Alerts */
.alert {
  border: 0;
  border-radius: var(--portal-radius-sm);
  padding: .8rem 1rem;
  box-shadow: var(--portal-shadow-sm);
}

.alert-info {
  background: #eaf2fb;
  color: #1c4a85;
}

.alert-success {
  background: #e7f6f0;
  color: #0a6b46;
}

.alert-warning {
  background: #fdf3e1;
  color: #8a571a;
}

@media (max-width: 575.98px) {
  .portal-panel,
  .metric {
    border-radius: 10px;
    padding: 16px;
  }

  .page-title {
    font-size: 1.35rem;
  }
}
