:root {
  --portal-ink: #232b32;
  --portal-muted: #64717c;
  --portal-line: #dce2e6;
  --portal-accent: #087e70;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 16px; min-height: 100%; }
body {
  margin: 0;
  color: var(--portal-ink);
  background: #f4f6f7;
  font-family: "Segoe UI", system-ui, sans-serif;
  line-height: 1.5;
}
.portal { min-height: 100vh; display: flex; flex-direction: column; }
a { color: #08776b; text-underline-offset: 3px; }
button, input, summary { -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; }
svg.lucide { width: 20px; height: 20px; flex-shrink: 0; stroke-width: 1.8; }
.portal-header { background: #fff; border-bottom: 1px solid var(--portal-line); }
.portal-nav {
  max-width: 1040px; min-height: 76px; margin: auto; padding: 12px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.portal-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--portal-ink); font-size: 19px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; color: #fff; background: #087e70; border-radius: 8px; }
.brand-mark svg { width: 23px; height: 23px; }
.account-actions { display: flex; align-items: center; gap: 14px; min-width: 0; }
.account-name { font-size: 14px; color: var(--portal-muted); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-main { width: 100%; flex: 1; }
.portal-footer { width: 100%; max-width: 1040px; margin: 32px auto 0; padding: 20px 28px; display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--portal-muted); }
.portal-footer a { color: var(--portal-muted); }
.workspace { max-width: 792px; margin: 0 auto; padding: 44px 24px 16px; }
.workspace-heading { margin-bottom: 30px; }
.section-label { color: var(--portal-muted); font-size: 11px; font-weight: 700; margin-bottom: 8px; }
h1 { font-size: 30px; font-weight: 650; line-height: 1.25; margin: 0 0 18px; }
.connection-line { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; font-size: 14px; }
.connection-address { display: flex; align-items: center; gap: 8px; overflow-wrap: anywhere; min-width: 0; }
.connection-address svg { color: var(--portal-muted); width: 17px; height: 17px; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 9px; border-radius: 5px; font-size: 11px; font-weight: 600; line-height: 1.4; }
.status-success { color: #176a50; background: #e2f3eb; }
.status-neutral { color: #596670; background: #e9edf0; }
.status-warning { color: #91610f; background: #fff1d3; }
.status-dot { height: 5px; width: 5px; background: currentColor; border-radius: 50%; flex-shrink: 0; }
.task { margin-bottom: 12px; }
.task-button {
  width: 100%; text-align: left; color: var(--portal-ink);
  display: flex; align-items: center; gap: 18px; min-height: 96px; padding: 20px 22px;
  background: #fff; border: 1px solid var(--portal-line); border-radius: 8px;
  cursor: pointer; list-style: none; transition: border-color .15s, background-color .15s;
}
summary::-webkit-details-marker { display: none; }
.task-button:hover { border-color: #a2bcb7; background: #fcfefd; }
.task-button:focus-visible, .text-action:focus-visible { outline: 3px solid #9bcec3; outline-offset: 3px; }
.task-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 8px; flex: 0 0 48px; }
.task-icon svg { width: 25px; height: 25px; }
.icon-mint { background: #e0f3ec; color: #19755d; }
.icon-blue { background: #e7effc; color: #406cad; }
.icon-peach { background: #fcece5; color: #a85e42; }
.icon-neutral { background: #edf0f3; color: #647080; }
.task-heading { flex: 1; min-width: 0; font-size: 17px; font-weight: 600; line-height: 1.4; }
.task-caption { display: block; font-size: 12px; font-weight: 400; color: var(--portal-muted); margin-top: 4px; overflow-wrap: anywhere; }
.task-chevron { color: #85919a; transition: transform .2s; width: 18px !important; }
.dialog-open { overflow: hidden; }
.task-dialog {
  padding: 0; border: 1px solid #d3dfda; border-radius: 8px;
  width: min(600px, calc(100% - 32px)); max-width: none;
  max-height: calc(100dvh - 48px); margin: auto; background: #fff; color: var(--portal-ink);
  box-shadow: 0 20px 70px #162b3433; overflow: hidden;
}
.task-dialog[open] { display: flex; flex-direction: column; animation: dialog-enter 320ms cubic-bezier(.2, .75, .25, 1) both; }
.task-dialog::backdrop { background: #1c28336b; backdrop-filter: blur(3px); }
.task-dialog[open]::backdrop { animation: dialog-backdrop-enter 320ms ease-out both; }
.task-dialog.is-closing { animation: dialog-exit 180ms ease-in both; }
.task-dialog.is-closing::backdrop { animation: dialog-backdrop-exit 180ms ease-in both; }
@keyframes dialog-enter {
  0% { opacity: 0; transform: translateY(12px) scale(.96); }
  65% { opacity: 1; transform: translateY(-1px) scale(1.008); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes dialog-exit {
  from { opacity: var(--dialog-exit-opacity, 1); transform: var(--dialog-exit-transform, none); }
  to { opacity: 0; transform: translateY(6px) scale(.98); }
}
@keyframes dialog-backdrop-enter {
  from { background: #1c283300; backdrop-filter: blur(0); }
  to { background: #1c28336b; backdrop-filter: blur(3px); }
}
@keyframes dialog-backdrop-exit {
  from { background: var(--backdrop-exit-color, #1c28336b); backdrop-filter: var(--backdrop-exit-blur, blur(3px)); }
  to { background: #1c283300; backdrop-filter: blur(0); }
}
.admin-dialog { width: min(700px, calc(100% - 32px)); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 24px; border-bottom: 1px solid var(--portal-line); flex-shrink: 0; }
.dialog-header h2 { font-size: 20px; font-weight: 650; line-height: 1.35; margin: 0; min-width: 0; overflow-wrap: anywhere; }
.task-body { padding: 24px; background: #fff; overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.task-body .task-form, .task-body .link-result { max-width: none; }
.task-body.administration { padding-top: 0; }
.administration > .alert { margin-top: 20px; }
.admin-menu { display: grid; gap: 12px; padding-top: 20px; }
.admin-choice { min-height: 84px; }
.admin-navigation { display: flex; align-items: center; gap: 16px; justify-content: space-between; padding: 18px 0 14px; position: sticky; top: 0; z-index: 1; background: #fff; border-bottom: 1px solid var(--portal-line); }
.admin-navigation h3 { margin: 0; font-size: 16px; font-weight: 650; outline: none; }
.task-form { display: grid; gap: 20px; max-width: 520px; }
.field label, .link-result label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; }
.field-short { max-width: 220px; }
.form-control, .form-select {
  min-height: 46px; border: 1px solid #cfd8de; border-radius: 6px;
  padding: 10px 12px; background-color: #fff; color: var(--portal-ink); font-size: 15px;
}
.form-control::placeholder { color: #929ba3; opacity: 1; }
.form-control:focus, .form-select:focus { border-color: #62a695; box-shadow: 0 0 0 3px #e0f1eb; }
.form-select { padding-right: 36px; }
.form-control[readonly] { background: #f5f7f8; }
.btn { min-height: 44px; border-radius: 6px; font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.btn-primary { background: var(--portal-accent); border-color: var(--portal-accent); color: #fff; }
.btn.btn-primary:hover, .btn.btn-primary:active { background: #096859; border-color: #096859; }
.btn.btn-outline-secondary { color: #53616c; border-color: #d4dde2; background: #fff; }
.btn.btn-outline-secondary:hover { color: #2c4642; background: #edf4f1; border-color: #b6cac2; }
.btn.btn-outline-danger { color: #ac4d4d; border-color: #ead2d2; }
.primary-action { justify-self: start; padding: 11px 18px; }
.btn:disabled, .btn:disabled:hover {
  color: #79838a; background: #e4e8eb; border-color: #d4dbe0;
  box-shadow: none; opacity: 1; cursor: not-allowed; pointer-events: auto;
}
.icon-button { width: 42px; height: 42px; min-height: 42px; padding: 0; flex: 0 0 42px; }
.text-action { border: 0; padding: 6px 0; background: transparent; color: #167460; display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; text-decoration: none; }
.text-action:hover { color: #064c3d; text-decoration: underline; }
.ip-detail { margin-bottom: 22px; }
.field-label { display: block; font-size: 12px; color: var(--portal-muted); margin-bottom: 6px; }
.ip-detail strong { display: block; font-size: 22px; font-weight: 600; overflow-wrap: anywhere; }
.access-state { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; color: #1d765a; }
.access-state > svg { margin-top: 2px; }
.access-state strong { display: block; font-size: 14px; }
.access-state span { display: block; font-size: 14px; color: var(--portal-muted); margin-top: 3px; overflow-wrap: anywhere; }
#own-access-form { margin-top: 16px; }
.alert { font-size: 14px; border-radius: 6px; padding: 12px 14px; overflow-wrap: anywhere; }
.alert-light { background: #f3f5f7; color: #606d78; border-color: #e0e5e8; }
.link-result { max-width: 520px; border-top: 1px solid var(--portal-line); margin-top: 24px; padding-top: 20px; }
.link-input { display: flex; gap: 8px; margin-bottom: 6px; }
.link-input input { min-width: 0; }
.count-label { font-size: 11px; font-weight: 500; color: var(--portal-muted); background: #eef1f3; border-radius: 4px; padding: 2px 6px; }
.admin-content { padding-bottom: 10px; }
.admin-row { padding: 16px 0; border-top: 1px solid #eef1f3; min-width: 0; }
.row-heading { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.row-heading strong { font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.row-heading .status-pill { flex-shrink: 0; max-width: 45%; }
.row-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 6px; font-size: 12px; color: var(--portal-muted); overflow-wrap: anywhere; }
.row-meta code { color: #445961; font-size: 13px; overflow-wrap: anywhere; }
.row-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; margin-top: 12px; }
.rename-editor { flex: 1; min-width: 0; }
.rename-editor > summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12px; color: #64747b; min-height: 42px; }
.rename-editor summary svg { width: 16px; height: 16px; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { min-width: 0; flex: 1; }
.inline-form .field { flex: 1; min-width: 0; }
.duration-editor .inline-form { align-items: flex-end; }
.assignment-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 42px; align-items: end; gap: 8px; }
.assignment-form .field label { margin-bottom: 0; }
.assignment-form input, .assignment-form select { margin-top: 7px; }
.admin-subheading { font-size: 13px; font-weight: 600; margin: 24px 0 4px; }
.empty-state { color: #85919a; font-size: 13px; padding: 12px 0; margin: 0; }
.auth-page { max-width: 420px; margin: 60px auto; padding: 24px; }
.auth-page .brand-mark { margin-bottom: 24px; }
.auth-page h1 { font-size: 26px; }
.auth-page .task-form { gap: 20px; }
.auth-ip { font-size: 13px; color: var(--portal-muted); margin-top: 24px; overflow-wrap: anywhere; }

@media (max-width: 575px) {
  .assignment-form { grid-template-columns: minmax(0, 1fr) 42px; }
  .assignment-form .field:first-of-type { grid-column: 1 / -1; }
  .row-actions .rename-editor[open] { flex-basis: 100%; }
  .portal-nav { min-height: 66px; padding: 12px 20px; }
  .portal-brand { font-size: 16px; gap: 8px; }
  .account-name { display: none; }
  .workspace { padding: 30px 20px 12px; }
  .workspace-heading { margin-bottom: 25px; }
  h1 { font-size: 25px; margin-bottom: 14px; }
  .connection-line { gap: 8px 12px; font-size: 13px; }
  .task-button { min-height: 90px; padding: 16px; gap: 14px; }
  .task-icon { width: 42px; height: 42px; flex-basis: 42px; }
  .task-icon svg { width: 23px; height: 23px; }
  .task-heading { font-size: 15px; }
  .task-caption { font-size: 11px; }
  .task-body { padding: 22px 16px; }
  .task-dialog, .admin-dialog { width: calc(100% - 24px); max-height: calc(100dvh - 24px); }
  .dialog-header { padding: 14px 16px; gap: 10px; }
  .dialog-header h2 { font-size: 18px; }
  .admin-choice { min-height: 80px; }
  .primary-action { width: 100%; }
  .portal-footer { padding: 20px; margin-top: 16px; }
  .ip-detail strong { font-size: 20px; }
  .auth-page { margin-top: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, *::backdrop { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.access-coverage-notice { margin-top: 18px; }
.access-coverage-notice p { margin: 10px 0; }
.site-coverage summary { cursor: pointer; margin-bottom: 12px; }
