/* 전자결재 화면 (ApprovalListPage / ApprovalNewPage / ApprovalDetailPage) */
.ap-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 0.25rem 0 3rem;
}

.ap-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

    .ap-head h3 {
        margin: 0;
        font-weight: 700;
    }

.ap-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border: 1px solid var(--app-border);
    background: transparent;
    color: var(--app-text);
    border-radius: 6px;
    padding: 0.35rem 0.9rem;
    font-size: 0.875rem;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

    .ap-btn:hover:not(:disabled) {
        background: var(--app-hover);
        color: var(--app-text);
    }

    .ap-btn:disabled {
        opacity: 0.5;
        cursor: default;
    }

    .ap-btn.primary {
        background: #2563eb;
        border-color: #2563eb;
        color: #fff;
        font-weight: 600;
    }

    .ap-btn.danger {
        color: #f87171;
        border-color: rgba(248, 113, 113, 0.6);
    }

.ap-link {
    border: none;
    background: none;
    color: #60a5fa;
    cursor: pointer;
    padding: 0 0.2rem;
    font-size: 0.85rem;
}

.ap-tabs {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 0.75rem;
}

.ap-tab {
    border: 1px solid var(--app-border);
    background: transparent;
    color: var(--app-muted);
    border-radius: 16px;
    padding: 0.2rem 0.85rem;
    font-size: 0.85rem;
    cursor: pointer;
}

    .ap-tab.active {
        background: var(--app-hover);
        color: var(--app-text);
        font-weight: 600;
    }

.ap-error {
    white-space: pre-line;
}

.ap-empty {
    padding: 2rem 0;
    text-align: center;
}

.ap-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.ap-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--app-border-soft);
    border-radius: 10px;
    background: var(--app-surface);
    color: var(--app-text);
    text-decoration: none;
}

    .ap-item:hover {
        background: var(--app-hover);
        color: var(--app-text);
    }

    .ap-item.turn {
        border-color: #eab308;
    }

.ap-item-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ap-item-title {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ap-item-sub {
    font-size: 0.78rem;
    color: var(--app-muted);
}

.ap-item-side {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.ap-type {
    font-size: 0.75rem;
    color: var(--app-muted);
    border: 1px solid var(--app-border);
    border-radius: 10px;
    padding: 0 0.45rem;
}

.ap-turn {
    font-size: 0.78rem;
    font-weight: 700;
    color: #1a1a1a;
    background: #facc15;
    border-radius: 10px;
    padding: 0.05rem 0.55rem;
}

.ap-urgent {
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    background: #dc2626;
    border-radius: 4px;
    padding: 0 0.3rem;
    margin-right: 0.3rem;
    vertical-align: middle;
}

.ap-card {
    border: 1px solid var(--app-border-soft);
    border-radius: 10px;
    background: var(--app-surface);
    padding: 0.85rem 1rem;
    margin-bottom: 0.75rem;
}

    .ap-card.turn {
        border-color: #eab308;
    }

.ap-card-title {
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.ap-row {
    display: grid;
    grid-template-columns: 110px 1fr;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.ap-label {
    font-size: 0.85rem;
    color: var(--app-muted);
}

.ap-input {
    width: 100%;
    background: var(--app-bg);
    color: var(--app-text);
    border: 1px solid var(--app-border);
    border-radius: 6px;
    padding: 0.35rem 0.6rem;
    font-size: 0.9rem;
}

.ap-textarea {
    min-height: 70px;
    margin-bottom: 0.5rem;
}

.ap-check {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.ap-hint {
    font-size: 0.78rem;
    color: var(--app-muted);
}

.ap-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.4rem;
}

    .ap-toolbar button {
        border: 1px solid var(--app-border);
        background: transparent;
        color: var(--app-text);
        border-radius: 5px;
        padding: 0.15rem 0.55rem;
        font-size: 0.82rem;
        cursor: pointer;
    }

        .ap-toolbar button:hover {
            background: var(--app-hover);
        }

/* 본문은 종이처럼 (Word 문서로 저장되므로 흰 바탕에서 보이는 대로) */
.ap-editor {
    min-height: 320px;
    max-height: 60vh;
    overflow: auto;
    background: #fff;
    color: #111;
    border-radius: 6px;
    padding: 1rem 1.2rem;
    font-family: 'Malgun Gothic', sans-serif;
    font-size: 10pt;
    outline: none;
    border: 1px solid var(--app-border);
}

    .ap-editor table {
        border-collapse: collapse;
    }

.ap-people {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
}

.ap-person {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border: 1px solid var(--app-border);
    border-radius: 14px;
    padding: 0.1rem 0.3rem 0.1rem 0.55rem;
    font-size: 0.85rem;
}

    .ap-person button {
        border: none;
        background: none;
        color: var(--app-muted);
        cursor: pointer;
        font-size: 0.75rem;
    }

.ap-seq {
    font-size: 0.7rem;
    font-weight: 700;
    background: #2563eb;
    color: #fff;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ap-add {
    background: transparent;
    color: #60a5fa;
    border: 1px dashed var(--app-border);
    border-radius: 14px;
    padding: 0.1rem 0.4rem;
    font-size: 0.85rem;
}

.ap-file {
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}

.ap-file-row {
    font-size: 0.88rem;
    padding: 0.15rem 0;
}

.ap-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

    .ap-actions.left {
        justify-content: flex-start;
    }

.ap-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.ap-doc-title {
    margin: 0;
    font-weight: 700;
}

.ap-meta {
    font-size: 0.82rem;
    color: var(--app-muted);
    margin: 0.3rem 0 0.4rem;
}

.ap-lines {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.ap-line {
    display: grid;
    grid-template-columns: 70px 1fr auto 90px;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.4rem;
    border-radius: 6px;
}

    .ap-line.me {
        background: rgba(37, 99, 235, 0.1);
    }

    .ap-line.turn {
        outline: 1px solid #eab308;
    }

.ap-line-name {
    font-weight: 600;
}

.ap-line-date {
    font-size: 0.78rem;
    color: var(--app-muted);
    text-align: right;
}

.ap-return {
    grid-column: 1 / -1;
    font-size: 0.82rem;
    color: #f87171;
}

.ap-comment {
    border-bottom: 1px solid var(--app-border-soft);
    padding: 0.4rem 0;
}

.ap-comment-head {
    font-size: 0.85rem;
}

.ap-comment-text {
    white-space: pre-line;
    font-size: 0.9rem;
}

.ap-comment-new {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

@media (max-width: 640.98px) {
    .ap-row {
        grid-template-columns: 1fr;
        gap: 0.2rem;
    }

    .ap-line {
        grid-template-columns: 60px 1fr auto;
    }

    .ap-line-date {
        display: none;
    }
}

/* 알림 설정 (NotificationSettingsPage) */
.ns-hint {
    margin: 0 0 0.6rem;
}

.ns-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 0.35rem;
}

.ns-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.55rem;
    border: 1px solid var(--app-border-soft);
    border-radius: 8px;
    font-size: 0.88rem;
    cursor: pointer;
}

    .ns-item.on {
        border-color: #2563eb;
        background: rgba(37, 99, 235, 0.1);
    }

/* ---- 편집기 도구 모음 (ApprovalEditor) ---- */
.ap-tool-group {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding-right: 0.45rem;
    margin-right: 0.2rem;
    border-right: 1px solid var(--app-border-soft);
}

    .ap-tool-group:last-child {
        border-right: none;
    }

.ap-tool-label {
    font-size: 0.78rem;
    color: var(--app-muted);
    margin-right: 0.1rem;
}

.ap-tool-num {
    width: 3.2rem;
    padding: 0.1rem 0.3rem;
    border-radius: 5px;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    color: var(--app-text);
    font-size: 0.82rem;
}

.ap-tool-x {
    color: var(--app-muted);
    font-size: 0.8rem;
}

.ap-tool-hint {
    font-size: 0.8rem;
    color: #f59e0b;
    margin-bottom: 0.3rem;
}

.ap-editor td, .ap-editor th {
    min-width: 2.5rem;
}

/* 본문 제목 줄 + 양식으로 저장 */
.ap-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ap-save-tpl {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 400;
}

.ap-input.small {
    width: 14rem;
    padding: 0.2rem 0.5rem;
    font-size: 0.85rem;
}

.ap-btn.small {
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
}

.ap-row.with-action {
    grid-template-columns: 110px 1fr auto;
}

.ap-link-btn {
    font-size: 0.82rem;
    white-space: nowrap;
    color: var(--app-accent);
    text-decoration: none;
}

.ap-back {
    border: none;
    background: none;
    color: var(--app-muted);
    font-size: 0.85rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 0.3rem;
}

    .ap-back:hover {
        background: var(--app-hover);
        color: var(--app-text);
    }

/* ---- 기안 양식 관리 ---- */
.ap-page.wide {
    max-width: 1300px;
}

.tpl-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 0.8rem;
    align-items: start;
}

.tpl-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.tpl-new {
    margin-bottom: 0.4rem;
}

.tpl-item {
    text-align: left;
    padding: 0.5rem 0.7rem;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--app-text);
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

    .tpl-item:hover {
        background: var(--app-hover);
    }

    .tpl-item.active {
        border-color: var(--app-accent);
        background: var(--app-hover);
        font-weight: 700;
    }

.tpl-empty {
    font-size: 0.85rem;
    padding: 0.5rem 0.2rem;
}

.tpl-tip {
    margin-bottom: 0.4rem;
}

.ap-editor.tpl-editor {
    min-height: 480px;
    max-height: 70vh;
}

.tpl-confirm {
    margin-right: auto;
    align-self: center;
    font-size: 0.85rem;
    color: var(--app-danger);
}

@media (max-width: 760px) {
    .tpl-layout {
        grid-template-columns: 1fr;
    }
}

/* ---- 워드 편집기 (DxRichEdit) ---- */
.ap-richedit {
    border: 1px solid var(--app-border);
    border-radius: 8px;
    overflow: hidden;
}

    .ap-richedit .ap-richedit-control {
        width: 100%;
        height: 620px;
    }

    .ap-richedit.tpl-editor .ap-richedit-control {
        height: calc(100vh - 260px);
        min-height: 560px;
    }


/* 결재 목록 위 버튼 묶음 + 내 결재 직인 패널 */
.ap-head-actions {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.ap-btn.on {
    background: var(--app-hover);
}

.seal-panel {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 0.9rem 1rem;
    margin-bottom: 0.9rem;
    border: 1px solid var(--app-border-soft);
    border-radius: 12px;
    background: var(--app-surface);
}

.seal-preview {
    flex: 0 0 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--app-border);
    border-radius: 10px;
    background: #fff;
    text-align: center;
    font-size: 0.78rem;
}

    .seal-preview img {
        max-width: 104px;
        max-height: 104px;
        object-fit: contain;
    }

.seal-empty {
    color: #777 !important;
    padding: 0 0.4rem;
}

.seal-side {
    flex: 1;
    min-width: 0;
}

.seal-title {
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.seal-hint {
    font-size: 0.82rem;
    margin-bottom: 0.6rem;
}

.seal-actions {
    display: flex;
    gap: 0.4rem;
}

.seal-error {
    margin-top: 0.5rem;
}
