
:root {
    --sw-dark: #2E3033;
    --sw-blue: #4397F8;
    --sw-mid: #606468;
    --sw-light: #F2F3F4;
    --sw-border: #d9dde0;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    height: 100%;
    background: #F2F3F4;
    color: #2E3033;
}

body.login-page {
    background: linear-gradient(135deg, #2E3033 0%, #606468 100%);
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 460px;
    background: #fff;
    border-radius: 18px;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(46,48,51,0.20);
}

.login-logo {
    display: inline-block;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: #F2F3F4;
    color: #4397F8;
    padding: 8px 12px;
    border-radius: 999px;
    margin-bottom: 16px;
}

.brand-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    display: block;
}

.login-branding {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.brand-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.login-card h1 {
    margin: 0 0 10px 0;
    font-size: 28px;
    line-height: 1.25;
}

.login-card p {
    margin: 0 0 22px 0;
    color: #606468;
    line-height: 1.5;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.login-form label {
    font-weight: 700;
}

.login-form input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #d9dde0;
    border-radius: 10px;
    font-size: 16px;
}

.login-form button {
    margin-top: 8px;
    background: #2E3033;
    color: #fff;
    border: 0;
    border-radius: 10px;
    padding: 14px 18px;
    font-size: 16px;
    cursor: pointer;
}

.login-error {
    background: #fff1f1;
    color: #8b2d2d;
    border: 1px solid #f0c9c9;
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 420px;
    background: #2E3033;
    color: #fff;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(96, 100, 104, 0.25);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.brand-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.brand-name {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #4397F8;
    margin-bottom: 8px;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 20px;
    line-height: 1.35;
}

.logout-link {
    color: #fff;
    text-decoration: none;
    background: rgba(255,255,255,0.12);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 13px;
}

.sidebar-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.sidebar-actions button {
    background: #4397F8;
    border: 0;
    color: #fff;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
}

#tree {
    padding: 15px;
    overflow: auto;
    flex: 1;
}

.tree-list {
    list-style: none;
    margin: 0;
    padding-left: 18px;
}

.tree-item {
    margin: 6px 0;
}

.tree-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 6px;
}

.tree-row:hover {
    background: rgba(255,255,255,0.08);
}

.tree-row.active {
    background: rgba(67,151,248,0.28);
}

.tree-toggle {
    width: 22px;
    min-width: 22px;
    height: 22px;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    background: rgba(255,255,255,0.12);
    color: #fff;
    font-weight: 700;
    line-height: 1;
}

.tree-toggle.is-empty {
    visibility: hidden;
}

.tree-label {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.tree-icon {
    font-size: 15px;
}

.tree-title {
    flex: 1;
    font-size: 14px;
    word-break: break-word;
}

.tree-actions {
    display: flex;
    gap: 4px;
}

.tree-actions button {
    border: 0;
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-radius: 4px;
    padding: 4px 6px;
    cursor: pointer;
    font-size: 12px;
}

.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: #fff;
    border-bottom: 1px solid var(--sw-border);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

#docTitle {
    flex: 1;
    padding: 12px;
    font-size: 18px;
    border: 1px solid var(--sw-border);
    border-radius: 8px;
    background: #fff;
}

#docTitle[readonly] {
    background: var(--sw-light);
    color: #2E3033;
    border-color: var(--sw-border);
}

.doc-mode-indicator {
    background: #F2F3F4;
    color: #4397F8;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.topbar-actions,
.editor-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.topbar-actions button,
.editor-toolbar button {
    background: #2E3033;
    color: #fff;
    border: 0;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.editor-toolbar {
    padding: 12px 16px;
    background: #F2F3F4;
    border-bottom: 1px solid var(--sw-border);
}

.editor-stage {
    flex: 1;
    overflow: auto;
    background: #F2F3F4;
    padding: 24px;
}

.editor {
    min-height: 100%;
    background: #fff;
    outline: none;
    line-height: 1.6;
    padding: 32px;
    border-radius: 14px;
    box-shadow: 0 12px 36px rgba(46, 48, 51, 0.10);
}

.editor.is-readonly {
    cursor: default;
}

.editor.is-editmode {
    border: 2px solid #4397F8;
}

.editor img,
.editor video,
.editor iframe {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 12px 0;
}

.editor video {
    display: block;
    width: 100%;
    max-width: 920px;
}

.editor iframe {
    width: 100%;
    max-width: 920px;
    min-height: 450px;
}

.editor a {
    color: #4397F8;
}

@media (max-width: 1100px) {
    .sidebar {
        width: 360px;
    }
}

@media (max-width: 900px) {
    .app {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: 320px;
    }

    .topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-left {
        flex-direction: column;
        align-items: stretch;
    }
}

.tree-row.is-dragging {
    opacity: 0.45;
}

.tree-row.drop-before {
    box-shadow: inset 0 3px 0 #4397F8;
}

.tree-row.drop-after {
    box-shadow: inset 0 -3px 0 #4397F8;
}

.tree-row.drop-inside {
    background: rgba(67,151,248,0.22);
    outline: 1px dashed rgba(67,151,248,0.9);
}

.editor a.swiki-doc-link {
    font-weight: 700;
}


.doc-picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 9999;
}

.doc-picker-overlay.is-open {
    display: flex;
}

.doc-picker-modal {
    width: 100%;
    max-width: 860px;
    max-height: 80vh;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0,0,0,0.35);
    display: flex;
    flex-direction: column;
}

.doc-picker-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px 18px 24px;
    border-bottom: 1px solid #d9dde0;
}

.doc-picker-kicker {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #4397F8;
    margin-bottom: 8px;
}

.doc-picker-header h3 {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
}

.doc-picker-close {
    border: 0;
    background: var(--sw-light);
    color: #2E3033;
    width: 40px;
    min-width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 26px;
    line-height: 1;
}

.doc-picker-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px 24px 24px 24px;
    min-height: 0;
}

.doc-picker-search {
    width: 100%;
    border: 1px solid #d9dde0;
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 16px;
}

.doc-picker-results {
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 120px;
}

.doc-picker-item {
    width: 100%;
    border: 1px solid #d9dde0;
    background: #fff;
    border-radius: 12px;
    text-align: left;
    padding: 14px 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.doc-picker-item:hover {
    border-color: #4397F8;
    background: #eff6ff;
}

.doc-picker-title {
    font-size: 16px;
    font-weight: 700;
    color: #2E3033;
}

.doc-picker-path {
    font-size: 13px;
    color: #6b7280;
    word-break: break-word;
}

.doc-picker-empty {
    padding: 20px;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    color: #6b7280;
    background: var(--sw-light);
}

.share-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 10000;
}

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

.share-modal {
    width: 100%;
    max-width: 760px;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0,0,0,0.35);
}

.share-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px 18px 24px;
    border-bottom: 1px solid #d9dde0;
}

.share-modal-kicker {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #4397F8;
    margin-bottom: 8px;
}

.share-modal-header h3 {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
}

.share-modal-close {
    border: 0;
    background: var(--sw-light);
    color: #2E3033;
    width: 40px;
    min-width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 26px;
    line-height: 1;
}

.share-modal-body {
    padding: 20px 24px 24px 24px;
}

.share-modal-itemname {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
}

.share-modal-hint {
    margin: 0 0 16px 0;
    color: #606468;
    line-height: 1.5;
}

.share-modal-linkrow {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.share-modal-link {
    flex: 1;
    border: 1px solid #d9dde0;
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 15px;
    background: var(--sw-light);
}

.share-copy-btn,
.share-create-btn,
.share-revoke-btn {
    border: 0;
    background: #2E3033;
    color: #fff;
    border-radius: 10px;
    padding: 12px 14px;
    cursor: pointer;
}

.share-revoke-btn {
    background: #b91c1c;
}

.share-modal-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.share-modal-status {
    margin-top: 14px;
    border-radius: 10px;
    padding: 12px 14px;
    background: var(--sw-light);
    color: #2E3033;
}

.share-modal-status.is-success {
    background: #dcfce7;
    color: #166534;
}

.share-modal-status.is-error {
    background: #fff1f1;
    color: #8b2d2d;
}

.share-modal-status.is-info {
    background: #F2F3F4;
    color: #4397F8;
}

body.share-page {
    background: #F2F3F4;
    min-height: 100vh;
    color: #2E3033;
}

.share-app {
    min-height: 100vh;
    display: flex;
}

.share-sidebar {
    width: 380px;
    background: #2E3033;
    color: #fff;
    padding: 24px 20px;
    overflow: auto;
}

.share-sidebar-header h1 {
    margin: 0 0 10px 0;
    font-size: 24px;
    line-height: 1.25;
}

.share-sidebar-header p {
    margin: 0;
    color: rgba(255,255,255,0.75);
    line-height: 1.5;
}

.share-tree-wrap {
    margin-top: 20px;
}

.share-tree-list {
    list-style: none;
    margin: 0;
    padding-left: 18px;
}

.share-tree-list.root {
    padding-left: 0;
}

.share-tree-item {
    margin: 8px 0;
}

.share-tree-folder {
    font-weight: 700;
    margin-bottom: 6px;
}

.share-tree-link {
    color: #fff;
    text-decoration: none;
    display: block;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.08);
}

.share-tree-link.is-active {
    background: rgba(67,151,248,0.28);
}

.share-content {
    flex: 1;
    padding: 24px;
    overflow: auto;
}

.share-topbar {
    background: #fff;
    border-radius: 16px;
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: 0 12px 36px rgba(46, 48, 51, 0.10);
}

.share-kicker {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #4397F8;
    margin-bottom: 8px;
}

.share-topbar h2 {
    margin: 0;
    font-size: 28px;
}

.share-editor,
.share-error-card {
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 12px 36px rgba(46, 48, 51, 0.10);
}

.share-editor img,
.share-editor video,
.share-editor iframe {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 12px 0;
}

.share-editor video,
.share-editor iframe {
    width: 100%;
    max-width: 920px;
}

.share-editor a {
    color: #4397F8;
}

.share-folder-list {
    padding-left: 20px;
}

.share-folder-list li {
    margin: 10px 0;
}

.share-error-card {
    max-width: 760px;
    margin: 60px auto;
}

@media (max-width: 900px) {
    .share-app {
        flex-direction: column;
    }

    .share-sidebar {
        width: 100%;
    }

    .share-modal-linkrow {
        flex-direction: column;
    }
}


.sidebar-actions button:hover,
.topbar-actions button:hover,
.editor-toolbar button:hover,
.login-form button:hover {
    background: var(--sw-blue);
}

#docTitle:focus,
.login-form input:focus,
.doc-picker-search:focus {
    outline: none;
    border-color: var(--sw-blue);
    box-shadow: 0 0 0 3px rgba(67,151,248,0.16);
}

.logout-link:hover {
    background: rgba(67,151,248,0.22);
}
