:root {
    --ink: #10233d;
    --muted: #64748b;
    --line: #d8e0e7;
    --surface: #ffffff;
    --canvas: #eef2f4;
    --green-950: #082b22;
    --green-800: #0b5442;
    --green-700: #0d6b54;
    --green-100: #e7f5ef;
    --orange: #c96917;
    --orange-100: #fff2e5;
    --danger: #b42318;
    --danger-100: #fff0ef;
    --blue-100: #eaf1fb;
    --shadow: 0 18px 48px rgba(16, 35, 61, .10);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--canvas);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.5;
    letter-spacing: 0;
}

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

a {
    color: var(--green-700);
    font-weight: 700;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.auth-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(320px, 42%) 1fr;
}

.brand-panel {
    display: flex;
    min-height: 100%;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(32px, 6vw, 88px);
    overflow: hidden;
    color: #fff;
    background: var(--green-950);
}

.brand-wordmark {
    display: flex;
    align-items: center;
    gap: 14px;
    color: #fff;
    font-size: 25px;
    font-weight: 800;
}

.brand-symbol {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 8px;
    color: #f8d6ae;
    font-size: 28px;
    font-weight: 900;
}

.brand-copy {
    max-width: 520px;
}

.brand-kicker {
    margin: 0 0 14px;
    color: #f0b979;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.brand-title {
    max-width: 12ch;
    margin: 0;
    font-size: clamp(38px, 4.5vw, 66px);
    line-height: 1.04;
}

.brand-note {
    max-width: 42ch;
    margin: 24px 0 0;
    color: #c9ded6;
    font-size: 17px;
}

.brand-footer {
    color: #91b7a8;
    font-size: 13px;
}

.auth-stage {
    display: grid;
    min-width: 0;
    padding: 32px;
    place-items: center;
}

.auth-card {
    width: min(100%, 480px);
    padding: clamp(28px, 5vw, 48px);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.auth-card h1,
.panel h2 {
    margin: 0;
    color: var(--ink);
}

.auth-card h1 {
    font-size: 30px;
}

.lead {
    margin: 8px 0 28px;
    color: var(--muted);
}

.field {
    min-width: 0;
    margin-top: 18px;
}

.field label,
.fieldset-label {
    display: block;
    margin-bottom: 7px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
}

.field input,
.field select,
.field textarea,
.search-input {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid #b9c6d2;
    border-radius: 6px;
    color: var(--ink);
    background: #fff;
    outline: none;
}

.field textarea {
    min-height: 128px;
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-input:focus {
    border-color: var(--green-700);
    box-shadow: 0 0 0 3px rgba(13, 107, 84, .14);
}

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

.checkbox-row,
.share-row {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font-size: 14px;
}

.checkbox-row {
    margin: 18px 0;
}

.checkbox-row input,
.share-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--green-700);
}

.button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 800;
    text-align: center;
}

.button:hover {
    text-decoration: none;
}

.button-primary {
    color: #fff;
    background: var(--green-700);
}

.button-primary:hover {
    background: var(--green-800);
}

.button-secondary {
    border-color: #b9c6d2;
    color: var(--ink);
    background: #fff;
}

.button-secondary:hover {
    background: #f6f8fa;
}

.button-danger {
    border-color: #efb4ae;
    color: var(--danger);
    background: #fff;
}

.button-small {
    min-height: 36px;
    padding: 6px 11px;
    font-size: 13px;
}

.button-block {
    width: 100%;
}

.alert {
    margin: 0 0 20px;
    padding: 12px 14px;
    border: 1px solid #efb4ae;
    border-radius: 6px;
    color: var(--danger);
    background: var(--danger-100);
    font-size: 14px;
}

.alert-success {
    border-color: #a8d9c6;
    color: var(--green-800);
    background: var(--green-100);
}

.alert-warning {
    border-color: #efc18f;
    color: #8b4b12;
    background: var(--orange-100);
}

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

.separator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.separator::before,
.separator::after {
    height: 1px;
    flex: 1;
    background: var(--line);
    content: "";
}

.app-header {
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.app-header-inner,
.app-main {
    width: min(100% - 32px, 1180px);
    margin-inline: auto;
}

.app-header-inner {
    display: flex;
    min-height: 72px;
    align-items: center;
    gap: 24px;
}

.app-brand {
    flex: 0 0 auto;
    color: var(--green-950);
    font-size: 20px;
    font-weight: 900;
}

.app-nav {
    display: flex;
    min-width: 0;
    align-self: stretch;
    align-items: center;
    gap: 4px;
}

.app-nav a {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--muted);
    font-size: 14px;
}

.app-nav a:hover,
.app-nav a.is-active {
    color: var(--green-800);
    background: var(--green-100);
    text-decoration: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
}

.user-name {
    color: var(--muted);
    font-size: 14px;
}

.link-button {
    padding: 0;
    border: 0;
    color: var(--green-700);
    background: transparent;
    cursor: pointer;
    font-weight: 800;
}

.app-main {
    padding-block: 34px 60px;
}

.page-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}

.page-heading h1 {
    margin: 0;
    font-size: 32px;
}

.page-heading p {
    margin: 5px 0 0;
    color: var(--muted);
}

.heading-actions,
.actions-row,
.item-actions,
.secret-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.status-badge,
.tag {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 800;
}

.status-badge {
    padding: 7px 10px;
    color: var(--green-800);
    background: var(--green-100);
}

.status-badge::before {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #16835f;
    content: "";
}

.tag {
    padding: 4px 7px;
    color: #39516f;
    background: var(--blue-100);
}

.tag-orange {
    color: #8b4b12;
    background: var(--orange-100);
}

.panel-grid {
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    gap: 18px;
    align-items: start;
}

.panel {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.panel h2 {
    font-size: 20px;
}

.panel-copy {
    margin: 7px 0 22px;
    color: var(--muted);
    font-size: 14px;
}

.qr-box {
    width: min(100%, 250px);
    margin: 18px 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.qr-box svg {
    display: block;
    width: 100%;
    height: auto;
}

.code-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 20px 0;
    padding: 0;
    list-style: none;
}

.code-list li {
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 13px;
    text-align: center;
}

.note {
    margin-top: 18px;
    padding: 12px 14px;
    border-left: 3px solid var(--orange);
    color: #7a4210;
    background: var(--orange-100);
    font-size: 14px;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.search-form {
    display: flex;
    min-width: 0;
    flex: 1;
    gap: 8px;
}

.search-input {
    max-width: 460px;
}

.vault-list {
    display: grid;
    gap: 8px;
}

.vault-item {
    display: grid;
    grid-template-columns: minmax(220px, 1.1fr) minmax(180px, 1fr) auto;
    gap: 18px;
    align-items: center;
    min-height: 84px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--green-700);
    border-radius: 8px;
    background: #fff;
}

.vault-item.is-favorite {
    border-left-color: var(--orange);
}

.item-title {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: 17px;
}

.item-subtitle,
.item-meta,
.empty-copy {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.item-actions {
    justify-content: flex-end;
}

.empty-state {
    padding: 44px 24px;
    border: 1px dashed #b9c6d2;
    border-radius: 8px;
    background: rgba(255, 255, 255, .62);
    text-align: center;
}

.empty-state h2 {
    margin: 0;
    font-size: 20px;
}

.form-shell {
    max-width: 920px;
}

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

.field-wide {
    grid-column: 1 / -1;
}

.password-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
}

.password-control input {
    min-width: 0;
}

.generator-row {
    display: grid;
    grid-template-columns: auto minmax(120px, 240px) 48px;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
    color: var(--muted);
    font-size: 13px;
}

.generator-row input[type="range"] {
    min-height: 24px;
    padding: 0;
    accent-color: var(--green-700);
}

.share-box {
    margin-top: 22px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafb;
}

.share-box h2 {
    margin: 0 0 4px;
    font-size: 17px;
}

.share-heading {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
}

.share-search {
    width: 100%;
    min-height: 42px;
    margin-top: 14px;
    padding: 8px 11px;
    border: 1px solid #b9c6d2;
    border-radius: 6px;
    color: var(--ink);
    background: #fff;
    outline: none;
}

.share-search:focus {
    border-color: var(--green-700);
    box-shadow: 0 0 0 3px rgba(13, 107, 84, .14);
}

.share-table {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}

.share-entry {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.share-entry.is-selected {
    border-color: #91cdb8;
    background: #f2faf6;
}

.share-name {
    display: block;
    color: var(--ink);
    font-weight: 800;
}

.share-email {
    color: var(--muted);
    font-size: 12px;
}

.share-permission {
    display: grid;
    min-width: 150px;
    gap: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.share-permission select {
    min-height: 38px;
    padding: 7px 9px;
    border: 1px solid #b9c6d2;
    border-radius: 6px;
    color: var(--ink);
    background: #fff;
}

.share-permission select:disabled {
    color: #8b98a7;
    background: #eef2f4;
}

.share-empty {
    margin: 4px 0;
    color: var(--muted);
    font-size: 13px;
}

.temporary-access {
    display: grid;
    grid-template-columns: minmax(220px, .8fr) minmax(0, 1.2fr);
    gap: 22px;
    margin-bottom: 22px;
    padding: 18px;
    border: 1px solid #efc18f;
    border-radius: 8px;
    color: #70400f;
    background: var(--orange-100);
}

.temporary-access h2,
.team-create h2,
.team-directory h2 {
    margin: 0;
    font-size: 20px;
}

.temporary-access p,
.team-create p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.temporary-access-grid {
    display: grid;
    gap: 12px;
}

.temporary-access-grid input {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid #d6a66f;
    border-radius: 6px;
    color: var(--ink);
    background: #fff;
}

.team-create {
    display: grid;
    grid-template-columns: minmax(200px, .55fr) minmax(0, 1.45fr);
    gap: 24px;
    align-items: end;
    padding: 20px 0 24px;
    border-bottom: 1px solid var(--line);
}

.team-create-form {
    display: grid;
    grid-template-columns: minmax(140px, .8fr) minmax(200px, 1.2fr) 150px auto;
    gap: 10px;
    align-items: end;
}

.team-create-form .field {
    margin-top: 0;
}

.team-directory {
    padding-top: 24px;
}

.team-directory-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

.team-directory-head span {
    color: var(--muted);
    font-size: 13px;
}

.team-user-list {
    display: grid;
    gap: 8px;
}

.team-user-row {
    display: grid;
    grid-template-columns: minmax(230px, 1fr) minmax(330px, auto) minmax(150px, auto);
    gap: 16px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.team-user-row > form:last-child .link-button {
    white-space: nowrap;
}

.team-user-row.is-inactive {
    background: #f3f5f7;
}

.team-user-identity {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 11px;
}

.team-avatar {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    place-items: center;
    border-radius: 7px;
    color: #fff;
    background: var(--green-800);
    font-weight: 900;
}

.team-user-identity strong,
.team-user-identity span,
.team-user-identity small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

.team-user-identity span,
.team-user-identity small {
    color: var(--muted);
    font-size: 12px;
}

.team-user-controls {
    display: flex;
    align-items: end;
    justify-content: flex-end;
    gap: 10px;
}

.team-user-controls label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.team-user-controls label > span {
    display: block;
    margin-bottom: 4px;
}

.team-user-controls select {
    min-height: 36px;
    padding: 6px 9px;
    border: 1px solid #b9c6d2;
    border-radius: 6px;
    background: #fff;
}

.team-active-control {
    display: flex;
    min-height: 36px;
    align-items: center;
    gap: 6px;
}

.team-active-control input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--green-700);
}

.form-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.detail-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(260px, .7fr);
    gap: 18px;
    align-items: start;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.detail-cell {
    min-width: 0;
    padding: 16px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.detail-cell:nth-child(2n) {
    border-right: 0;
}

.detail-cell-wide {
    grid-column: 1 / -1;
    border-right: 0;
}

.detail-label {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.detail-value {
    margin: 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.secret-line {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
}

.secret-line input {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    background: #f8fafb;
}

.side-panel {
    display: grid;
    gap: 12px;
}

.history-list,
.access-list {
    display: grid;
    gap: 8px;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
}

.history-list li,
.access-list li {
    padding-top: 8px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
}

.history-list strong,
.access-list strong {
    color: var(--ink);
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--line);
    background: #fff;
}

.audit-table th,
.audit-table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.audit-table th {
    color: var(--muted);
    background: #f8fafb;
    font-size: 11px;
    text-transform: uppercase;
}

.audit-table td {
    font-size: 13px;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

@media (max-width: 850px) {
    .auth-shell {
        grid-template-columns: 1fr;
        grid-template-rows: 180px 1fr;
    }

    .brand-panel {
        min-height: 180px;
        gap: 24px;
        padding: 28px;
    }

    .brand-copy {
        display: none;
    }

    .auth-stage {
        padding: 22px 16px 40px;
        place-items: start center;
    }

    .app-header-inner {
        flex-wrap: wrap;
        gap: 8px 16px;
        padding-block: 10px;
    }

    .app-nav {
        order: 3;
        width: 100%;
        overflow-x: auto;
    }

    .panel-grid,
    .detail-shell {
        grid-template-columns: 1fr;
    }

    .temporary-access,
    .team-create {
        grid-template-columns: 1fr;
    }

    .team-create-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .team-user-row {
        grid-template-columns: minmax(210px, 1fr) auto;
    }

    .team-user-row > form:last-child {
        grid-column: 2;
    }

    .page-heading {
        align-items: start;
        flex-direction: column;
    }

    .vault-item {
        grid-template-columns: 1fr auto;
    }

    .vault-item > :nth-child(2) {
        grid-column: 1;
    }

    .item-actions {
        grid-column: 2;
        grid-row: 1 / span 2;
    }
}

@media (max-width: 620px) {
    .app-header-inner,
    .app-main {
        width: min(100% - 24px, 1180px);
    }

    .user-name {
        display: none;
    }

    .form-grid,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-cell,
    .detail-cell:nth-child(2n) {
        grid-column: 1;
        border-right: 0;
    }

    .toolbar,
    .search-form {
        align-items: stretch;
        flex-direction: column;
    }

    .search-input {
        max-width: none;
    }

    .vault-item {
        grid-template-columns: 1fr;
    }

    .vault-item > :nth-child(2),
    .item-actions {
        grid-column: 1;
        grid-row: auto;
        justify-content: flex-start;
    }

    .password-control {
        grid-template-columns: 1fr auto;
    }

    .password-control input {
        grid-column: 1 / -1;
    }

    .generator-row {
        grid-template-columns: 1fr 44px;
    }

    .generator-row label {
        grid-column: 1 / -1;
    }

    .share-entry {
        grid-template-columns: 1fr;
    }

    .share-heading,
    .team-directory-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .team-create-form,
    .team-user-row {
        grid-template-columns: 1fr;
    }

    .team-create-form .button,
    .team-user-controls {
        width: 100%;
    }

    .team-user-controls {
        align-items: stretch;
        flex-direction: column;
    }

    .team-user-row > form:last-child {
        grid-column: 1;
    }

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

@media (max-width: 480px) {
    .auth-card {
        padding: 24px 20px;
    }

    .code-list {
        grid-template-columns: 1fr;
    }
}
