:root {
    --bg: #19303c;
    --accent: #00b4c4;
    --text: #ffffff;
    --muted: rgba(255, 255, 255, 0.75);
    --card: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.14);
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
    --danger: rgba(255, 87, 87, 0.9);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { color: inherit; text-decoration: none; }
a:not(.iconbtn):hover { text-decoration: underline; }

.container {
    width: min(1200px, calc(100% - 48px));
    margin: 0 auto;
    padding: 32px 0 56px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

header {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    align-items: end;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.brand { grid-column: 1 / span 2; }

.headerright {
    grid-column: 3 / -1;
    justify-self: end;
    display: flex;
    justify-content: flex-end;
}

.brand img {
    width: 285px;
    max-width: 100%;
    height: auto;
    display: block;
}

.pagetitle {
    grid-column: 1 / -1;
    margin-top: 18px;
}

.pagetitlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.pagetitlebar h1 {
    margin: 0;
    font-size: 28px;
    letter-spacing: 0.2px;
}

.pagetitle h1 {
    margin: 0;
    font-size: 28px;
    letter-spacing: 0.2px;
}

.createbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
}

.createbtn:hover { background: rgba(255, 255, 255, 0.10); }

.createbtn.disabled {
    opacity: 0.45;
    pointer-events: none;
}

.iconbar {
    display: flex;
    gap: 10px;
    align-items: center;
}

.iconbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.9);
}

.iconbtn:hover { background: rgba(255, 255, 255, 0.10); }

.iconbtn.disabled {
    opacity: 0.45;
    pointer-events: none;
}

.iconbtn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.iconbtn.small {
    width: 34px;
    height: 34px;
    border-radius: 10px;
}

.iconbtn.small svg {
    width: 16px;
    height: 16px;
}

.status { color: var(--muted); font-size: 13px; }

.userline .top {
    display: flex;
    gap: 10px;
    align-items: center;
}

.badge {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(0, 180, 196, 0.18);
    border: 1px solid rgba(0, 180, 196, 0.45);
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
}

.statuspill {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.2px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.92);
    white-space: nowrap;
}

.statuspill.active {
    border-color: rgba(34, 197, 94, 0.6);
    background: rgba(34, 197, 94, 0.16);
}

.statuspill.inactive {
    border-color: rgba(239, 68, 68, 0.6);
    background: rgba(239, 68, 68, 0.16);
}

.colorline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.swatch {
    width: 16px;
    height: 16px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15) inset;
    flex: 0 0 auto;
}

main {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 12px;
}

.panel {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 18px;
    box-shadow: var(--shadow);
}

.panel h2 { margin: 0 0 14px; font-size: 18px; }

.page-record .sectiontitle {
    font-size: 22px;
    margin-top: 6px;
}

.page-record .readonlyview label {
    font-size: 13px;
    margin-top: 6px;
}

.panelhead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.panelhead h2 { margin: 0; }

.kv {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 10px 14px;
    font-size: 13px;
}

.k { color: rgba(255, 255, 255, 0.7); font-size: 12px; text-transform: uppercase; letter-spacing: 0.8px; }

.v { color: var(--text); }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th, td {
    text-align: left;
    padding: 10px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
    vertical-align: middle;
}

th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255, 255, 255, 0.7);
}

.right { text-align: right; }

.rowactions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}

label {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-top: 8px;
    margin-bottom: 6px;
    font-weight: 700;
}

label.k {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 400;
}

input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(25, 48, 60, 0.55);
    color: var(--text);
    outline: none;
    font-size: 13px;
}

input, select { height: 40px; }

textarea {
    min-height: 110px;
    resize: vertical;
}

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

.span2 { grid-column: span 2; }
.span3 { grid-column: 1 / -1; }

.vblock {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(25, 48, 60, 0.55);
    color: var(--text);
    font-size: 13px;
    min-height: 40px;
    display: flex;
    align-items: center;
}

.vblock.long {
    min-height: 110px;
    align-items: flex-start;
    white-space: pre-wrap;
    line-height: 1.4;
}

.vblock.rich {
    display: block;
}

.vblock.rich ul,
.vblock.rich ol {
    margin: 0;
    padding-left: 18px;
}

.vblock.rich li {
    margin: 0;
}

.vblock.rich ul ul,
.vblock.rich ol ol,
.vblock.rich ul ol,
.vblock.rich ol ul {
    margin: 0;
}

.vblock.rich p {
    margin: 0 0 8px;
}

.vblock.rich a {
    color: var(--text);
    text-decoration: underline;
}

.tagbadges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 6px;
}

.tagbadge {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.85);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
}

.tagbadge:hover { background: rgba(255, 255, 255, 0.10); }

.taghint {
    color: var(--muted);
    font-size: 12px;
    margin: 0 0 6px;
}

.vempty { color: rgba(255, 255, 255, 0.55); }

.error {
    color: rgba(255, 120, 120, 0.95);
    font-weight: 800;
    font-size: 12px;
}

.info {
    color: rgba(255, 255, 255, 0.75);
    font-weight: 800;
    font-size: 12px;
}

.plist a {
    display: block;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(255, 255, 255, 0.04);
}

.statusbox.draft,
.plist a.draft { border-color: rgba(239, 68, 68, 0.85); }

.statusbox.pending_dpo_approval,
.plist a.pending_dpo_approval { border-color: rgba(249, 115, 22, 0.85); }

.statusbox.pending_governing_board_approval,
.plist a.pending_governing_board_approval { border-color: rgba(250, 204, 21, 0.85); }

.statusbox.approved,
.plist a.approved { border-color: rgba(34, 197, 94, 0.85); }

.plist a:hover { background: rgba(255, 255, 255, 0.08); }

.plist a.selected {
    background: rgba(0, 180, 196, 0.24);
    border-color: rgba(0, 180, 196, 0.65);
    box-shadow: 0 0 0 1px rgba(0, 180, 196, 0.25) inset;
}

.grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.actions {
    margin-top: 14px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
}

.page-records button,
.page-users button:not(.actionbtn) {
    height: 40px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid rgba(0, 180, 196, 0.45);
    background: rgba(0, 180, 196, 0.18);
    color: var(--text);
    font-weight: 800;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}

.page-records button:hover,
.page-users button:not(.actionbtn):hover { background: rgba(255, 255, 255, 0.10); }

.page-users .rowactions {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.page-users .actionbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    padding: 0;
}

.page-users .actionbtn:hover { background: rgba(255, 255, 255, 0.10); }

.page-users .actionbtn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.page-index .brand p {
    margin: 10px 0 0;
    color: var(--muted);
    line-height: 1.5;
}

.page-index .status {
    font-size: 13px;
    color: var(--muted);
    padding: 0;
    border: 0;
    background: transparent;
    border-radius: 0;
}

.page-index .status form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 0;
}

.page-index .status .row.tokenrow {
    grid-template-columns: 1fr auto auto auto;
}

.page-index .status input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(25, 48, 60, 0.55);
    color: var(--text);
    outline: none;
    font-size: 13px;
}

.page-index .status input[name="token"] {
    min-width: 220px;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 4px;
    text-align: center;
}

.page-index .status input::placeholder { color: rgba(255, 255, 255, 0.55); }

.page-index .status button {
    width: auto;
    height: 40px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}

.page-index .status .statusbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
    text-decoration: none;
}

.page-index .status button:hover,
.page-index .status .statusbtn:hover {
    background: rgba(255, 255, 255, 0.10);
}

.page-index .status .error {
    color: rgba(255, 120, 120, 0.95);
    font-weight: 700;
    font-size: 12px;
}

.page-index .status .info {
    color: rgba(255, 255, 255, 0.75);
    font-weight: 700;
    font-size: 12px;
}

.page-index .status .userline {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.page-index .status .userline .top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.page-index .status .logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: var(--muted);
}

.page-index .status .logout:hover {
    border-color: rgba(0, 180, 196, 0.55);
    color: var(--text);
}

.page-index .card.disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.page-index .card.disabled:hover {
    transform: none;
    border-color: var(--border);
    background: var(--card);
}

.page-index nav {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 6px;
}

.page-index .card {
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: 16px;
    padding: 18px;
    box-shadow: var(--shadow);
    min-height: 160px;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 10px;
    transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.page-index .card:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 180, 196, 0.55);
    background: rgba(255, 255, 255, 0.08);
}

.page-index .card h2 {
    margin: 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-index .card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.page-index .cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.10);
    color: var(--text);
    font-weight: 600;
}

.page-index .arrow {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: rgba(0, 180, 196, 0.15);
    border: 1px solid rgba(0, 180, 196, 0.35);
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}

.page-index .arrow span {
    color: var(--text);
    font-size: 18px;
    line-height: 1;
}

.page-index main {
    grid-column: 1 / -1;
    padding-top: 4px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.page-index .panel {
    grid-column: 1 / span 4;
    border: 1px dashed rgba(0, 180, 196, 0.35);
    border-radius: 16px;
    padding: 18px;
    background: rgba(0, 180, 196, 0.07);
    color: var(--muted);
    line-height: 1.6;
}

.page-index .panel strong { color: var(--text); }

.page-clients .dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    margin-right: 8px;
    background: rgba(255, 255, 255, 0.18);
}

.page-clients .rowactions {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.page-clients .actionbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    padding: 0;
}

.page-clients .actionbtn:hover { background: rgba(255, 255, 255, 0.10); }

.page-clients .actionbtn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.page-clients .actionbtn.disabled {
    opacity: 0.45;
    pointer-events: none;
}

.page-clients button {
    width: auto;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(0, 180, 196, 0.45);
    background: rgba(0, 180, 196, 0.18);
    color: var(--text);
    font-weight: 800;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}

.page-clients button:hover {
    background: rgba(0, 180, 196, 0.25);
    border-color: rgba(0, 180, 196, 0.65);
}

.page-client .actions {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.page-migration a { color: inherit; text-decoration: none; }

.page-migration a:not(.iconbtn):hover { text-decoration: none; }

.page-migration header .brand { grid-column: 1 / span 3; }

.page-migration header .brand h1 {
    margin: 0;
    font-size: 28px;
    letter-spacing: 0.2px;
}

.page-migration .status {
    grid-column: 4;
    justify-self: end;
    padding: 10px 12px;
    border: 1px solid var(--border);
    background: rgba(0, 180, 196, 0.10);
    border-radius: 12px;
    font-size: 13px;
    color: var(--muted);
}

.page-migration main {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.page-migration .panel {
    grid-column: 1 / span 4;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.04);
    box-shadow: var(--shadow);
}

.page-migration .panel h2 {
    margin: 0 0 8px;
    font-size: 16px;
}

.page-migration .panel p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.page-migration .grid {
    grid-column: 1 / span 4;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.page-migration .card {
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: 16px;
    padding: 18px;
    box-shadow: var(--shadow);
}

.page-migration .card h3 {
    margin: 0 0 10px;
    font-size: 14px;
    color: var(--text);
}

.page-migration .mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 13px;
    line-height: 1.6;
    color: var(--muted);
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

.page-migration form { margin: 0; }

.page-migration .actions {
    grid-column: 1 / span 4;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0;
}

.page-migration .btn {
    appearance: none;
    border: 1px solid rgba(0, 180, 196, 0.45);
    background: rgba(0, 180, 196, 0.18);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
}

.page-migration .btn:hover {
    background: rgba(0, 180, 196, 0.25);
    border-color: rgba(0, 180, 196, 0.65);
}

.page-migration .link {
    color: var(--muted);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: 12px;
}

.page-migration .link:hover {
    border-color: rgba(0, 180, 196, 0.55);
    color: var(--text);
}

.page-migration .alert {
    grid-column: 1 / span 4;
    border-radius: 16px;
    padding: 14px 16px;
    border: 1px solid rgba(255, 87, 87, 0.35);
    background: rgba(255, 87, 87, 0.12);
}

.page-migration .alert strong { color: var(--danger); }

.page-migration ul {
    margin: 10px 0 0;
    padding-left: 18px;
    color: var(--muted);
    line-height: 1.6;
}

.appfooter {
    grid-column: 1 / -1;
    padding: 14px 0 22px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.appfooter div {
    opacity: 0.85;
}

@media (max-width: 920px) {
    .container,
    header,
    main {
        grid-template-columns: 1fr;
    }

    .brand { grid-column: 1; }
    .headerright { grid-column: 1; justify-self: start; margin-top: 10px; flex-wrap: wrap; }
    .panel { grid-column: 1 !important; }
    .kv { grid-template-columns: 1fr; }

    .grid2 { grid-template-columns: 1fr; }

    .page-index nav { grid-template-columns: 1fr; }
}
