.application-portal {
    height: 100%;
    overflow: auto;
    color: #17233a;
    background:
        radial-gradient(circle at 12% -8%, rgba(74, 133, 214, 0.16), transparent 30%),
        radial-gradient(circle at 96% 8%, rgba(255, 177, 32, 0.12), transparent 24%),
        #f4f7fb;
}

.application-portal[hidden], .designer-shell[hidden] { display: none !important; }

.app-home-header {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    padding: 0 42px;
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid #e2e8f1;
    backdrop-filter: blur(16px);
}

.app-home-brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.app-home-logo { display: grid; place-items: center; width: 40px; height: 40px; color: white; background: linear-gradient(145deg, #153f7b, #2e67ae); border-radius: 12px; box-shadow: 0 8px 18px rgba(27, 76, 137, 0.22); font-weight: 850; }
.app-home-brand strong, .app-home-brand small { display: block; }
.app-home-brand strong { font-size: 15px; }
.app-home-brand small { margin-top: 3px; color: #8994a8; font-size: 10px; letter-spacing: .08em; }
.app-home-actions { display: flex; align-items: center; gap: 10px; }
.app-home-actions a, .app-home-actions button, .application-detail-actions button {
    min-height: 36px;
    padding: 0 16px;
    color: #53627a;
    background: white;
    border: 1px solid #dce3ed;
    border-radius: 9px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 650;
    text-decoration: none;
}
.app-home-actions button, .application-detail-actions button:not(.outline) { color: white; background: #245ca4; border-color: #245ca4; box-shadow: 0 6px 15px rgba(36, 92, 164, .18); }
.app-home-actions .message-center-trigger { position: relative; color: #53627a; background: white; border-color: #dce3ed; box-shadow: none; }
.message-center-trigger { position: relative; gap: 6px; }
.message-unread-badge { display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 5px; color: white; background: #e25050; border-radius: 9px; font-size: 9px; font-weight: 800; line-height: 1; }
.message-unread-badge[hidden] { display: none; }
.app-home-actions a:hover, .application-detail-actions .outline:hover { color: #245ca4; border-color: #aebcd0; }

.app-home-main { width: min(1220px, calc(100% - 64px)); margin: 0 auto; padding: 42px 0 70px; }
.app-home-hero { display: flex; align-items: flex-end; justify-content: space-between; padding: 12px 4px 38px; }
.app-home-hero > div > span, .application-detail-hero > div > span { color: #8090a9; font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.app-home-hero h1 { margin: 7px 0 10px; font-size: 34px; letter-spacing: -.04em; }
.app-home-hero p, .application-detail-hero p { margin: 0; color: #738098; font-size: 14px; }
.app-home-summary { display: flex; align-items: baseline; gap: 8px; padding: 15px 20px; background: rgba(255,255,255,.72); border: 1px solid rgba(218,225,236,.9); border-radius: 14px; }
.app-home-summary strong { color: #1f579c; font-size: 26px; }
.app-home-summary span { color: #7a879c; font-size: 12px; }

.app-section-heading, .process-section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.app-section-heading h2, .process-section-heading h2 { margin: 0 0 5px; font-size: 18px; }
.app-section-heading p, .process-section-heading p { margin: 0; color: #8894a8; font-size: 12px; }
.app-section-heading button { padding: 7px 12px; color: #65738a; background: transparent; border: 0; cursor: pointer; font-size: 12px; }

.application-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.application-card {
    position: relative;
    min-height: 260px;
    padding: 24px;
    overflow: hidden;
    background: rgba(255,255,255,.94);
    border: 1px solid #e0e6ef;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(38, 61, 94, .07);
    transition: 180ms ease;
}
.application-card::after { content: ""; position: absolute; right: -40px; bottom: -52px; width: 150px; height: 150px; background: radial-gradient(circle, rgba(50,106,177,.1), transparent 68%); }
.application-card:hover { transform: translateY(-3px); border-color: #b9cae0; box-shadow: 0 16px 36px rgba(38, 61, 94, .12); }
.application-card-top { display: flex; align-items: flex-start; justify-content: space-between; }
.application-card-icon { display: grid; place-items: center; width: 52px; height: 52px; color: white; background: linear-gradient(145deg, #245ca4, #4f83c5); border-radius: 15px; box-shadow: 0 8px 18px rgba(36,92,164,.22); font-size: 20px; font-weight: 800; }
.application-card:nth-child(3n + 2) .application-card-icon { background: linear-gradient(145deg, #eb9600, #ffb21a); box-shadow: 0 8px 18px rgba(235,150,0,.2); }
.application-card:nth-child(3n + 3) .application-card-icon { background: linear-gradient(145deg, #238f83, #34b4a6); box-shadow: 0 8px 18px rgba(35,143,131,.2); }
.application-status { padding: 5px 9px; color: #218a70; background: #e9f8f3; border-radius: 12px; font-size: 10px; font-weight: 750; }
.application-status.disabled { color: #8a94a5; background: #f0f2f5; }
.application-card h3 { margin: 20px 0 7px; font-size: 18px; }
.application-card p { height: 36px; margin: 0; overflow: hidden; color: #7a879c; font-size: 12px; line-height: 18px; }
.application-card-processes { position: relative; z-index: 2; display: grid; gap: 7px; margin: 18px 0 14px; padding-top: 14px; border-top: 1px solid #edf0f5; }
.application-process-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto 14px; align-items: center; gap: 9px; width: 100%; min-height: 48px; padding: 7px 9px; color: #34435a; background: #f8fafc; border: 1px solid #edf1f6; border-radius: 9px; cursor: pointer; text-align: left; transition: 140ms ease; }
.application-process-row:hover { color: #245ca4; background: #f1f6fc; border-color: #cfdae8; }
.mini-flow-icon { display: grid; place-items: center; width: 28px; height: 28px; color: #245ca4; background: #e9f1fb; border-radius: 8px; font-size: 14px; }
.mini-flow-copy { min-width: 0; }
.mini-flow-copy strong, .mini-flow-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-flow-copy strong { font-size: 11px; }
.mini-flow-copy small { margin-top: 3px; color: #929daf; font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; }
.application-process-row em { padding: 4px 7px; color: #247b68; background: #e8f7f2; border-radius: 10px; font-size: 9px; font-style: normal; font-weight: 750; white-space: nowrap; }
.application-process-row em.draft, .application-process-row em.modified { color: #956613; background: #fff2d4; }
.application-process-row em.disabled { color: #7c8798; background: #eceff3; }
.application-process-row > b { color: #8390a3; font-size: 16px; }
.application-no-process { padding: 16px 10px; color: #929dae; background: #fafbfd; border: 1px dashed #d8e0eb; border-radius: 9px; font-size: 10px; text-align: center; }
.application-enter-button { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 12px 2px 0; color: #66758d; background: none; border: 0; border-top: 1px solid #edf0f5; cursor: pointer; font-size: 11px; }
.application-enter-button strong { color: #245ca4; font-size: 11px; }

.app-loading-card, .app-empty-state { grid-column: 1 / -1; display: grid; place-items: center; min-height: 220px; padding: 30px; color: #8490a4; background: rgba(255,255,255,.75); border: 1px dashed #ccd6e4; border-radius: 17px; font-size: 13px; text-align: center; }
.app-empty-state strong { display: block; margin-bottom: 7px; color: #43516a; font-size: 16px; }

.app-breadcrumb { display: flex; align-items: center; gap: 9px; margin: -10px 0 22px; color: #8793a6; font-size: 12px; }
.app-breadcrumb a { color: #56708f; text-decoration: none; }
.app-breadcrumb strong { color: #384861; }
.application-detail-hero { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 20px; margin-bottom: 35px; padding: 28px 30px; background: linear-gradient(115deg, #fff, #f8fbff); border: 1px solid #dee6f0; border-radius: 20px; box-shadow: 0 10px 30px rgba(38,61,94,.07); }
.application-detail-icon { display: grid; place-items: center; width: 64px; height: 64px; color: white; background: linear-gradient(145deg, #194a88, #3d75b8); border-radius: 18px; box-shadow: 0 9px 20px rgba(31,83,148,.22); font-size: 24px; font-weight: 800; }
.application-detail-hero h1 { margin: 6px 0 7px; font-size: 26px; }
.application-detail-actions { display: flex; gap: 9px; }
.process-section-heading > span { padding: 6px 10px; color: #66778f; background: #eaf0f7; border-radius: 12px; font-size: 11px; font-weight: 700; }
.managed-process-list { display: grid; gap: 12px; }
.managed-process-card { display: grid; grid-template-columns: 48px minmax(0, 1fr) 110px 130px 58px 36px; align-items: center; gap: 16px; min-height: 92px; padding: 18px 20px; background: white; border: 1px solid #e0e6ef; border-radius: 14px; cursor: pointer; transition: 160ms ease; }
.managed-process-card:hover { border-color: #b7c7dc; box-shadow: 0 9px 24px rgba(38,61,94,.09); transform: translateY(-1px); }
.managed-process-icon { display: grid; place-items: center; width: 42px; height: 42px; color: #245ca4; background: #edf4fd; border-radius: 12px; font-size: 18px; font-weight: 800; }
.managed-process-copy { min-width: 0; }
.managed-process-copy strong, .managed-process-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.managed-process-copy strong { margin-bottom: 6px; font-size: 14px; }
.managed-process-copy span { color: #8691a4; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.managed-process-version { color: #65748c; font-size: 11px; }
.managed-process-status { justify-self: start; padding: 6px 10px; color: #247b68; background: #e9f8f3; border-radius: 13px; font-size: 10px; font-style: normal; font-weight: 750; }
.managed-process-status.draft { color: #9a6b14; background: #fff5dc; }
.managed-process-status.modified { color: #9a6b14; background: #fff0d0; }
.managed-process-delete { min-height: 30px; padding: 0 10px; color: #bc4e4e; background: #fff7f7; border: 1px solid #f0cccc; border-radius: 7px; cursor: pointer; font-size: 10px; font-weight: 700; }
.managed-process-delete:hover { color: white; background: #c95555; border-color: #c95555; }
.managed-process-delete:disabled { opacity: .55; cursor: wait; }
.managed-process-action-placeholder { width: 58px; }
.managed-process-arrow { color: #8190a6; font-size: 20px; }

.app-management-dialog { width: min(520px, calc(100vw - 32px)); padding: 0; overflow: hidden; color: #1c293f; background: white; border: 0; border-radius: 17px; box-shadow: 0 28px 80px rgba(20,38,65,.25); }
.app-management-dialog::backdrop { background: rgba(24,35,56,.42); backdrop-filter: blur(3px); }
.app-management-dialog header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid #e5e9f0; }
.app-management-dialog header span { color: #8895a9; font-size: 8px; font-weight: 800; letter-spacing: .16em; }
.app-management-dialog h2 { margin: 4px 0 0; font-size: 19px; }
.app-management-dialog header button { width: 30px; height: 30px; color: #7a879b; background: #f2f4f7; border: 0; border-radius: 50%; cursor: pointer; font-size: 19px; }
.app-dialog-body { display: grid; gap: 16px; padding: 23px 24px; }
.app-dialog-body label > span, .app-dialog-body label > small { display: block; }
.app-dialog-body label > span { margin-bottom: 7px; color: #4f5e76; font-size: 11px; font-weight: 700; }
.app-dialog-body label > small { margin-top: 5px; color: #98a2b2; font-size: 9px; }
.app-dialog-body input, .app-dialog-body textarea, .app-dialog-body select { width: 100%; min-height: 40px; padding: 9px 11px; color: #27354c; background: #fbfcfe; border: 1px solid #dbe2ec; border-radius: 8px; outline: 0; font-size: 12px; }
.app-dialog-body textarea { min-height: 82px; resize: vertical; }
.app-dialog-body input:focus, .app-dialog-body textarea:focus, .app-dialog-body select:focus { border-color: #6f99ca; box-shadow: 0 0 0 3px rgba(36,92,164,.09); }
.app-dialog-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.app-management-dialog footer { display: flex; justify-content: flex-end; gap: 9px; padding: 15px 24px; background: #f8fafc; border-top: 1px solid #e7ebf1; }
.app-management-dialog footer button { min-height: 36px; padding: 0 18px; color: white; background: #245ca4; border: 1px solid #245ca4; border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 700; }
.app-management-dialog footer .cancel { color: #55647a; background: white; border-color: #d8e0eb; }

.message-center-dialog { width: min(680px, calc(100vw - 32px)); }
.message-center-dialog > section { display: grid; grid-template-rows: auto auto minmax(0, 1fr); max-height: min(760px, calc(100vh - 48px)); }
.message-center-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 20px; background: #f8fafc; border-bottom: 1px solid #e8ecf2; }
.message-center-toolbar p { margin: 0; color: #7f8b9e; font-size: 10px; }
.message-center-toolbar button { padding: 6px 10px; color: #245ca4; background: white; border: 1px solid #d8e2ef; border-radius: 7px; cursor: pointer; font-size: 10px; font-weight: 700; }
.message-center-list { min-height: 280px; max-height: calc(100vh - 190px); padding: 10px 0; overflow-y: auto; background: white; }
.message-center-empty { display: grid; place-items: center; min-height: 230px; padding: 24px; color: #929daf; font-size: 11px; text-align: center; }
.message-center-item { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 12px; padding: 15px 20px; border-bottom: 1px solid #eef1f5; }
.message-center-item:last-child { border-bottom: 0; }
.message-center-item.unread { background: #f7fbff; }
.message-read-dot { width: 8px; height: 8px; margin-top: 5px; background: transparent; border-radius: 50%; }
.message-center-item.unread .message-read-dot { background: #2c6cb5; box-shadow: 0 0 0 4px rgba(44,108,181,.09); }
.message-center-copy { min-width: 0; }
.message-center-copy strong { display: block; color: #35445c; font-size: 12px; }
.message-center-copy p { margin: 6px 0 7px; color: #727f93; font-size: 10px; line-height: 1.55; }
.message-center-meta { display: flex; flex-wrap: wrap; gap: 9px; color: #99a3b3; font-size: 8px; }
.message-center-actions { display: flex; align-items: center; gap: 6px; }
.message-center-actions button, .message-center-actions a { padding: 6px 9px; color: #56708f; background: white; border: 1px solid #dfe6ef; border-radius: 7px; cursor: pointer; font-size: 9px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.message-center-actions a { color: #245ca4; background: #edf4fd; }

@media (max-width: 900px) {
    .application-grid { grid-template-columns: 1fr; }
    .managed-process-card { grid-template-columns: 44px minmax(0, 1fr) 90px 58px 32px; }
    .managed-process-version { display: none; }
}

@media (max-width: 640px) {
    .app-home-header { padding: 0 18px; }
    .app-home-actions a { display: none; }
    .app-home-actions .message-center-trigger { display: inline-flex; }
    .app-home-main { width: calc(100% - 28px); padding-top: 24px; }
    .app-home-hero { align-items: flex-start; }
    .app-home-hero h1 { font-size: 27px; }
    .app-home-summary { display: none; }
    .application-grid { grid-template-columns: 1fr; }
    .application-detail-hero { grid-template-columns: auto 1fr; padding: 20px; }
    .application-detail-actions { grid-column: 1 / -1; }
    .managed-process-card { grid-template-columns: 42px minmax(0, 1fr) 52px 32px; gap: 9px; }
    .managed-process-version, .managed-process-status { display: none; }
    .managed-process-action-placeholder { width: 52px; }
}
