:root {
    --ls-page: #f3f7fc;
    --ls-surface: #ffffff;
    --ls-surface-soft: #f8fbff;
    --ls-border: #d7e0ec;
    --ls-border-strong: #c9d6e7;
    --ls-text: #121827;
    --ls-muted: #5d6f91;
    --ls-blue: #0b73ea;
    --ls-blue-dark: #075bad;
    --ls-blue-soft: #eaf4ff;
    --ls-green: #27c46b;
    --ls-purple: #7446ff;
    --ls-shadow: 0 22px 52px rgba(31, 55, 84, 0.11);
    --ls-radius: 8px;
    --ls-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: var(--ls-font);
    color: var(--ls-text);
    background: var(--ls-page);
    letter-spacing: 0;
}

button,
input,
textarea {
    font: inherit;
}

a {
    color: inherit;
}

.shell {
    width: min(1280px, calc(100% - 48px));
    margin: 0 auto;
}

.site-header {
    height: 86px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--ls-border);
}

.header-inner {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.brand img {
    display: block;
    width: 260px;
    height: auto;
}

.primary-button,
.secondary-button,
.icon-button {
    border: 0;
    border-radius: var(--ls-radius);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 44px;
    white-space: nowrap;
    transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.primary-button {
    padding: 0 22px;
    color: #ffffff;
    background: var(--ls-blue);
    box-shadow: 0 8px 20px rgba(11, 115, 234, 0.18);
    font-weight: 600;
}

.primary-button:hover {
    background: var(--ls-blue-dark);
    transform: translateY(-1px);
}

.primary-button.compact {
    min-height: 44px;
    padding: 0 22px;
}

.secondary-button {
    padding: 0 20px;
    color: var(--ls-text);
    background: #f8fafc;
    font-weight: 600;
    text-decoration: none;
}

.secondary-button.compact {
    min-height: 38px;
    padding: 0 16px;
}

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

.button-icon {
    font-size: 22px;
    line-height: 1;
    font-weight: 500;
}

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

.full-width {
    width: 100%;
}

.app-main {
    padding-top: 24px;
}

.app-main h1,
.section-heading h1 {
    margin: 0 0 28px;
    font-size: 30px;
    line-height: 1.2;
    font-weight: 800;
    color: var(--ls-text);
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.app-card {
    min-height: 330px;
    overflow: hidden;
    border: 1px solid var(--ls-border);
    border-radius: var(--ls-radius);
    background: var(--ls-surface);
    box-shadow: var(--ls-shadow);
    cursor: grab;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease, transform 0.16s ease;
}

.app-card:hover,
.app-card:focus-visible {
    border-color: rgba(11, 115, 234, 0.42);
    box-shadow: 0 24px 58px rgba(31, 55, 84, 0.16);
    outline: 0;
    transform: translateY(-1px);
}

.app-card:active {
    cursor: grabbing;
}

.app-card.is-dragging {
    opacity: 0.38;
}

.app-card.is-drop-target {
    border-color: var(--ls-blue);
    box-shadow: 0 0 0 3px rgba(11, 115, 234, 0.16), var(--ls-shadow);
}

.app-card.is-inactive {
    filter: grayscale(1);
    opacity: 0.48;
    cursor: grab;
}

.app-card-media {
    height: 174px;
    padding: 18px 20px;
    border-bottom: 1px solid #eef2f6;
    background-color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-card-media img {
    width: 100%;
    max-width: 360px;
    height: 122px;
    object-fit: contain;
    display: block;
}

.app-card-content {
    min-height: 154px;
    padding: 22px;
    display: grid;
    grid-template-columns: 1fr;
    align-content: start;
    gap: 10px;
}

.app-card h2 {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
    font-weight: 800;
}

.app-card-title-button {
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    display: block;
    font: inherit;
    font-weight: inherit;
    text-align: left;
}

.app-card-title-button:hover,
.app-card-title-button:focus-visible {
    color: var(--ls-blue-dark);
    outline: 0;
}

.app-card-content p {
    margin: 0;
    color: var(--ls-muted);
    font-size: 14px;
    line-height: 1.45;
    min-height: calc(14px * 1.45 * 3);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.linkedin-card {
    position: relative;
    min-height: 330px;
    overflow: visible;
    border: 1px solid var(--ls-border);
    border-radius: var(--ls-radius);
    background: var(--ls-surface);
    box-shadow: var(--ls-shadow);
    z-index: 4;
}

.linkedin-card-trigger {
    width: 100%;
    min-height: 330px;
    border: 0;
    border-radius: var(--ls-radius);
    background: #ffffff;
    color: var(--ls-text);
    cursor: pointer;
    display: grid;
    grid-template-rows: 174px 154px;
    align-items: start;
    gap: 0;
    padding: 0;
    text-align: left;
    overflow: hidden;
}

.linkedin-card-trigger:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 3px rgba(11, 115, 234, 0.16);
}

.linkedin-card-mark {
    width: 122px;
    height: 122px;
    margin: 26px auto;
    border-radius: 8px;
    background: #0a66c2;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: 0;
}

.linkedin-card-copy {
    min-height: 154px;
    padding: 22px;
    display: grid;
    align-content: start;
    gap: 10px;
}

.linkedin-card-title {
    display: block;
    font-size: 24px;
    line-height: 1.2;
    font-weight: 800;
}

.linkedin-card-description {
    color: var(--ls-muted);
    font-size: 14px;
    line-height: 1.45;
    min-height: calc(14px * 1.45 * 3);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.linkedin-card-chevron {
    position: absolute;
    right: 22px;
    bottom: 22px;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: var(--ls-blue-soft);
    color: var(--ls-blue);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.linkedin-card.is-open .linkedin-card-chevron {
    transform: rotate(180deg);
}

.linkedin-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 30;
    display: none;
    border: 1px solid var(--ls-border);
    border-radius: var(--ls-radius);
    background: #ffffff;
    box-shadow: 0 20px 46px rgba(15, 23, 42, 0.18);
    overflow: hidden;
}

.linkedin-card.is-open .linkedin-menu {
    display: block;
}

.linkedin-menu a {
    min-height: 44px;
    padding: 12px 16px;
    color: var(--ls-text);
    text-decoration: none;
    display: flex;
    align-items: center;
    font-size: 14px;
    line-height: 1.3;
    font-weight: 700;
}

.linkedin-menu a:hover,
.linkedin-menu a:focus-visible {
    background: var(--ls-blue-soft);
    color: var(--ls-blue-dark);
    outline: 0;
}

.empty-state {
    min-height: 240px;
    border: 1px dashed var(--ls-border-strong);
    border-radius: var(--ls-radius);
    background: rgba(255, 255, 255, 0.62);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ls-muted);
    font-weight: 600;
    grid-column: 1 / -1;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 26px;
    background: rgba(8, 13, 20, 0.42);
}

.modal-overlay.is-open {
    display: flex;
}

.modal-panel {
    width: min(1140px, 100%);
    max-height: calc(100vh - 52px);
    border-radius: var(--ls-radius);
    background: var(--ls-surface);
    box-shadow: 0 28px 80px rgba(13, 23, 38, 0.34);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.admin-modal {
    width: min(680px, 100%);
}

.app-details-modal {
    width: min(760px, 100%);
}

.modal-header {
    height: 74px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #eef2f6;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
}

.icon-button {
    width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;
    background: transparent;
    color: #79879a;
    font-size: 18px;
}

.icon-button:hover {
    background: #f1f5f9;
    color: var(--ls-text);
}

.modal-body {
    padding: 24px;
    overflow: auto;
}

.app-details-body {
    color: #263247;
    font-size: 15px;
    line-height: 1.65;
}

.app-details-body > :first-child {
    margin-top: 0;
}

.app-details-body > :last-child {
    margin-bottom: 0;
}

.app-details-body h3,
.app-details-body h4 {
    margin: 20px 0 8px;
    color: var(--ls-text);
    line-height: 1.25;
}

.app-details-body a {
    color: var(--ls-blue);
    font-weight: 700;
}

.app-details-footer .hidden {
    display: none;
}

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

.available-app {
    min-height: 82px;
    border: 1px solid var(--ls-border);
    border-radius: var(--ls-radius);
    background: var(--ls-surface);
    padding: 12px;
    display: grid;
    grid-template-columns: 48px 1fr auto;
    align-items: center;
    gap: 12px;
}

.available-app img {
    width: 48px;
    height: 48px;
    border-radius: var(--ls-radius);
    border: 1px solid #dce4ef;
    background: #f9fbfd;
    object-fit: contain;
}

.available-app h3 {
    margin: 0 0 4px;
    font-size: 14px;
    line-height: 1.25;
    font-weight: 800;
}

.available-app p {
    margin: 0;
    color: #53688b;
    font-size: 12px;
    line-height: 1.35;
}

.add-small-button {
    min-width: 76px;
    min-height: 36px;
    padding: 0 12px;
    border: 0;
    border-radius: 6px;
    color: #0874ff;
    background: var(--ls-blue-soft);
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.add-small-button.is-added {
    color: #067735;
    background: #e4faed;
}

.modal-footer {
    min-height: 88px;
    padding: 16px 24px;
    border-top: 1px solid #eef2f6;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    background: var(--ls-surface);
}

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

.admin-body {
    background: #f5f8fb;
}

.login-panel {
    width: min(420px, 100%);
    margin: 80px auto 0;
}

.admin-login-form {
    padding: 24px;
    border: 1px solid var(--ls-border);
    border-radius: var(--ls-radius);
    background: var(--ls-surface);
    box-shadow: var(--ls-shadow);
}

.admin-login-form label,
.form-field label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 800;
    color: #263247;
}

.admin-login-form input,
.form-field input,
.form-field textarea {
    width: 100%;
    border: 1px solid var(--ls-border-strong);
    border-radius: var(--ls-radius);
    background: #ffffff;
    color: var(--ls-text);
    outline: 0;
}

.rich-text-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.rich-text-toolbar button {
    min-width: 38px;
    min-height: 34px;
    border: 1px solid var(--ls-border-strong);
    border-radius: 6px;
    background: #ffffff;
    color: #263247;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
}

.rich-text-toolbar button:hover,
.rich-text-toolbar button:focus-visible {
    border-color: rgba(11, 115, 234, 0.55);
    color: var(--ls-blue-dark);
    outline: 0;
}

.rich-text-editor {
    width: 100%;
    min-height: 156px;
    padding: 12px;
    border: 1px solid var(--ls-border-strong);
    border-radius: var(--ls-radius);
    background: #ffffff;
    color: var(--ls-text);
    outline: 0;
    overflow: auto;
}

.rich-text-editor:focus {
    border-color: rgba(11, 115, 234, 0.55);
    box-shadow: 0 0 0 3px rgba(11, 115, 234, 0.12);
}

.admin-login-form input,
.form-field input {
    min-height: 44px;
    padding: 0 12px;
}

.form-field textarea {
    min-height: 112px;
    padding: 12px;
    resize: vertical;
}

.admin-login-form input:focus,
.form-field input:focus,
.form-field textarea:focus {
    border-color: rgba(11, 115, 234, 0.55);
    box-shadow: 0 0 0 3px rgba(11, 115, 234, 0.12);
}

.admin-login-form .primary-button {
    margin-top: 16px;
}

.form-alert {
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: var(--ls-radius);
    color: #8a2626;
    background: #fff0f0;
    font-size: 13px;
    font-weight: 700;
}

.form-alert.success {
    color: #08723a;
    background: #e5faee;
}

.hidden {
    display: none !important;
}

.admin-list {
    display: grid;
    gap: 12px;
}

.admin-row {
    border: 1px solid var(--ls-border);
    border-radius: var(--ls-radius);
    background: #ffffff;
    padding: 16px;
    display: grid;
    grid-template-columns: 64px 1fr auto;
    align-items: center;
    gap: 16px;
}

.admin-row.is-inactive {
    opacity: 0.58;
}

.admin-row img {
    width: 64px;
    height: 64px;
    border: 1px solid #dde6f0;
    border-radius: var(--ls-radius);
    object-fit: contain;
    background: #f8fbff;
}

.admin-row h2 {
    margin: 0 0 4px;
    font-size: 16px;
}

.admin-row p {
    margin: 0 0 4px;
    color: var(--ls-muted);
    font-size: 13px;
}

.admin-row a {
    color: var(--ls-blue);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.edit-app-button {
    align-self: center;
}

.modal-form {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.form-grid {
    display: grid;
    gap: 16px;
}

.checkbox-field {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
    color: #263247;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.checkbox-field input {
    width: 18px !important;
    height: 18px !important;
    min-height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    accent-color: var(--ls-blue);
}

@media (max-width: 980px) {
    .app-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 680px) {
    .shell {
        width: min(100% - 28px, 1280px);
    }

    .site-header {
        height: auto;
        min-height: 76px;
    }

    .header-inner {
        padding: 14px 0;
    }

    .brand img {
        width: 210px;
    }

    .primary-button {
        min-height: 42px;
        padding: 0 14px;
    }

    .app-grid,
    .available-grid {
        grid-template-columns: 1fr;
    }

    .app-card {
        min-height: 286px;
    }

    .linkedin-card,
    .linkedin-card-trigger {
        min-height: 286px;
    }

    .linkedin-card-trigger {
        grid-template-rows: 150px 132px;
        padding: 0;
    }

    .linkedin-card-mark {
        width: 104px;
        height: 104px;
        margin: 23px auto;
        font-size: 34px;
    }

    .app-card-media {
        height: 150px;
    }

    .app-card-content {
        min-height: 132px;
        padding: 18px;
    }

    .linkedin-card-copy {
        min-height: 132px;
        padding: 18px;
    }

    .modal-overlay {
        padding: 12px;
    }

    .modal-panel {
        max-height: calc(100vh - 24px);
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .available-app {
        grid-template-columns: 48px 1fr;
    }

    .available-app .add-small-button {
        grid-column: 1 / -1;
        width: 100%;
    }

    .admin-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .admin-row {
        grid-template-columns: 52px 1fr;
    }

    .admin-row .edit-app-button {
        grid-column: 1 / -1;
        justify-self: start;
    }
}
