﻿:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --ink: #13233a;
    --muted: #607086;
    --line: #d9e1ec;
    --brand: #0b5cab;
    --brand-2: #11999e;
    --danger: #cf304a;
    --ok: #1a8755;
    --shadow: 0 10px 30px rgba(8, 33, 70, 0.08);
    --shadow-soft: 0 6px 18px rgba(8, 33, 70, 0.06);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", "Trebuchet MS", sans-serif;
    color: var(--ink);
    background: radial-gradient(circle at top right, #eaf4ff, transparent 40%), var(--bg);
}

a { color: var(--brand); text-decoration: none; }

.app-body {
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    gap: 10px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
    padding: 10px 18px 12px;
    margin: 0;
}

.topbar-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.topbar-sub {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border-top: 1px solid #e8eef7;
    padding-top: 8px;
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; min-width: 0; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand img { width: 110px;  object-fit: contain; }
/* Keep header compact: logo only */
.brand span { display: none; }

.menu-toggle-btn {
    display: none;
    border: 1px solid #cfe0f3;
    border-radius: 8px;
    background: #fff;
    color: #0b5cab;
    padding: 8px 10px;
    align-items: center;
    gap: 8px;
}

.topnav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.topnav > a,
.nav-group-toggle {
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    font-size: 14px;
    background: #fff;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.topnav > a.active,
.nav-group.active > .nav-group-toggle { background: linear-gradient(90deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent; }

.nav-group { position: relative; }
.nav-group-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 210px;
    display: none;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow-soft);
    padding: 6px;
    z-index: 30;
}
.nav-group:hover .nav-group-menu,
.nav-group.open .nav-group-menu { display: grid; gap: 4px; }
.nav-group-menu a {
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--ink);
    font-size: 13px;
    background: #fff;
}
.nav-group-menu a:hover,
.nav-group-menu a.active {
    background: #eef5ff;
    color: #0b5cab;
}

.userbox { text-align: right; min-width: 0; }
.userbox strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userbox small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userbox a { font-size: 13px; }

.quick-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.quick-link {
    font-size: 13px;
    padding: 7px 10px;
    border: 1px solid #cfe0f3;
    border-radius: 8px;
    background: #fff;
    color: #0b5cab;
    white-space: nowrap;
}
.quick-link-alert {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    position: relative;
}
.quick-link-alert.active {
    border-color: #0b5cab;
    background: #edf5ff;
}
.quick-link-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: #cf304a;
    line-height: 1;
}
.quick-link:hover {
    border-color: #0b5cab;
    background: #f1f7ff;
}
.quick-link-primary {
    border-color: #0b5cab;
    background: linear-gradient(90deg, #0b5cab, #11999e);
    color: #fff;
}
.quick-link-primary:hover {
    border-color: #0b5cab;
    background: linear-gradient(90deg, #0a4c91, #0f868a);
}
.quick-link-icon {
    min-width: 86px;
}

.top-modal {
    position: fixed;
    inset: 0;
    background: rgba(6, 18, 34, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1350;
}
.top-modal.active { display: flex; }
.top-modal-card {
    width: min(920px, 96vw);
    max-height: 90vh;
    overflow: auto;
    background: #fff;
    border: 1px solid #d9e1ec;
    border-radius: 14px;
    padding: 14px;
}
.top-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.top-modal-head h2 { margin: 0; }
.top-search-result {
    margin-top: 10px;
    border: 1px solid #d9e2f1;
    border-radius: 10px;
    max-height: 65vh;
    overflow: auto;
    padding: 10px;
}
.top-search-category { margin-bottom: 10px; }
.top-search-category h4 {
    margin: 4px 0 8px;
    font-size: 13px;
    color: #496079;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.top-search-item {
    display: block;
    border: 1px solid #e2ebf8;
    border-radius: 10px;
    padding: 8px 10px;
    margin-bottom: 6px;
    color: #12243d;
    background: #fbfdff;
}
.top-search-item:hover {
    border-color: #a8c0e8;
    background: #f1f7ff;
}
.top-search-item small {
    display: block;
    color: #607086;
    margin-top: 2px;
}

.container {
    max-width: 1360px;
    margin: 12px auto 0;
    padding: 12px 18px 32px;
    display: grid;
    gap: 16px;
}

.page-head {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
    padding: 16px 18px;
}
.page-head h1 { margin: 0; font-size: 26px; }
.page-head p { margin: 6px 0 0; color: var(--muted); }

.cards { display: grid; gap: 14px; }
.cards.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cards.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 18px;
}
.card h2, .card h3 { margin-top: 0; }
.card.stat strong { font-size: 34px; color: var(--brand); }

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

label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
input, select, textarea, button {
    font: inherit;
}
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
}
textarea { resize: vertical; }

table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); text-align: left; padding: 10px; font-size: 14px; }
th { color: var(--muted); font-weight: 600; }
.table-wrap {
    margin-top: 10px;
    border: 1px solid #d9e1ec;
    border-radius: 10px;
    overflow: auto;
}

.btn {
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
}
.btn-primary { background: linear-gradient(90deg, var(--brand), var(--brand-2)); color: #fff; }
.w-full { width: 100%; }

.alert {
    margin: 10px 0;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
}
.alert-error { background: #ffeaf0; color: #8e1f36; }
.alert-ok { background: #e8f8f0; color: #16623f; }

.cloud-link-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    align-items: center;
}

.cloud-link-list {
    margin-top: 8px;
    display: grid;
    gap: 6px;
}

.cloud-link-item {
    font-size: 13px;
    color: #425c79;
    background: #f4f8ff;
    border: 1px solid #d3dff0;
    border-radius: 8px;
    padding: 6px 8px;
}

.od-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 18, 34, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1300;
}

.od-modal-overlay.active { display: flex; }

.od-modal-card {
    width: min(1100px, 96vw);
    max-height: 92vh;
    overflow: auto;
    background: #fff;
    border: 1px solid #d9e1ec;
    border-radius: 14px;
    padding: 14px;
}

.od-modal-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.od-modal-head h2 { margin: 0; }

.od-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 340px) auto auto 1fr;
    gap: 8px;
    align-items: end;
    margin-top: 10px;
}

.od-table-wrap {
    margin-top: 10px;
    border: 1px solid #d9e1ec;
    border-radius: 10px;
    overflow: hidden;
}

#cloudPickerTable td:first-child,
#cloudPickerTable th:first-child {
    width: 56px;
    text-align: center;
}

.od-item-name {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.od-item-icon {
    font-size: 15px;
}

.od-item-icon-folder {
    color: #d39a2a;
}

.od-item-icon-file {
    color: #2e5f93;
}

.od-item-name-text {
    display: inline-block;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.od-type-badge {
    display: inline-block;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid #cddcf0;
}

.od-type-badge.folder {
    background: #fff8e9;
    color: #9a6a10;
    border-color: #f2d9a6;
}

.od-type-badge.file {
    background: #edf4ff;
    color: #244b72;
    border-color: #c9dbf5;
}

.flat-list, .timeline-list {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 8px;
}
.inline-edit { cursor: pointer; border-bottom: 1px dashed #90a1b8; }

.login-page {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: clamp(12px, 3vw, 20px);
    background: linear-gradient(130deg, #0a2947, #185f97, #1f7f7a);
}

.login-shell {
    width: min(1060px, 100%);
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    background: #fff;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 30px 50px rgba(4, 15, 31, 0.35);
}

.login-brand {
    padding: clamp(22px, 4vw, 36px);
    color: #fff;
    background: linear-gradient(170deg, #0a2d53, #11558c);
}
.login-brand h1 { margin: 8px 0 10px; line-height: 1.2; }
.login-brand p { margin: 0; max-width: 40ch; color: rgba(255, 255, 255, 0.9); }
.brand-logo { width: clamp(96px, 22vw, 180px); height: clamp(96px, 22vw, 180px); object-fit: contain; }
.login-card { padding: clamp(18px, 4vw, 36px); display: grid; align-content: center; }
.login-card h2 { margin-top: 0; margin-bottom: 10px; }
.login-card p { margin-top: 0; }

.teams-fab {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1400;
    border: 1px solid #2e6fb8;
    border-radius: 999px;
    padding: 10px 14px;
    color: #fff;
    background: linear-gradient(120deg, #2b7cd3, #00a4bd);
    box-shadow: 0 12px 22px rgba(15, 54, 99, 0.35);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.teams-fab-badge {
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    background: #cf304a;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}
.teams-fab.teams-fab-blink {
    animation: teamsFabBlink 1s ease-in-out infinite;
}
@keyframes teamsFabBlink {
    0%, 100% { box-shadow: 0 12px 22px rgba(15, 54, 99, 0.35); }
    50% { box-shadow: 0 0 0 6px rgba(207, 48, 74, 0.22), 0 12px 22px rgba(15, 54, 99, 0.35); }
}

.teams-widget {
    position: fixed;
    right: 18px;
    bottom: 74px;
    width: min(860px, calc(100vw - 26px));
    height: min(620px, calc(100vh - 120px));
    z-index: 1399;
    border: 1px solid #cddcf0;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 20px 46px rgba(9, 37, 74, 0.28);
    display: none;
    overflow: hidden;
}
.teams-widget.open {
    display: block;
}
.teams-widget-head {
    padding: 10px 12px;
    border-bottom: 1px solid #d9e1ec;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(90deg, #f3f9ff, #f7fcfd);
}
.teams-widget-head-actions {
    display: inline-flex;
    gap: 6px;
}
.teams-mobile-back-btn {
    display: none;
}
.teams-widget-body {
    height: calc(100% - 48px);
    display: grid;
    grid-template-columns: 280px 1fr;
}
.teams-widget-chats {
    border-right: 1px solid #e2e8f2;
    display: grid;
    grid-template-rows: auto auto 1fr;
    min-height: 0;
}
.teams-widget-search-wrap {
    padding: 10px;
    border-bottom: 1px solid #edf2f8;
}
.teams-widget-newchat {
    padding: 8px 10px;
    border-bottom: 1px solid #edf2f8;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px;
    align-items: center;
}
.teams-widget-newchat input {
    min-height: 34px;
}
.teams-chat-list {
    overflow: auto;
    padding: 8px;
    display: grid;
    gap: 6px;
}
.teams-chat-item {
    width: 100%;
    text-align: left;
    border: 1px solid #dce5f2;
    border-radius: 10px;
    padding: 8px 10px;
    background: #fff;
    color: #123152;
    display: grid;
    gap: 4px;
    cursor: pointer;
}
.teams-chat-item strong {
    font-size: 13px;
    line-height: 1.2;
}
.teams-chat-item strong .teams-chat-status {
    font-style: normal;
    font-size: 10px;
    font-weight: 700;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 999px;
    border: 1px solid #cdd9ea;
    color: #5d718a;
    background: #f6f9ff;
}
.teams-chat-item strong .teams-chat-status.available {
    color: #106b3a;
    border-color: #a6d9ba;
    background: #eaf8f0;
}
.teams-chat-item strong .teams-chat-status.busy,
.teams-chat-item strong .teams-chat-status.donotdisturb {
    color: #8a1f31;
    border-color: #ebc0cb;
    background: #fff0f3;
}
.teams-chat-item strong .teams-chat-status.away,
.teams-chat-item strong .teams-chat-status.berightback {
    color: #915e10;
    border-color: #ecd6a6;
    background: #fff8ea;
}
.teams-chat-item strong .teams-chat-status.offline {
    color: #5d718a;
    border-color: #d4dceb;
    background: #f4f7fc;
}
.teams-chat-item small {
    font-size: 12px;
    color: #5a6d85;
}
.teams-chat-item span {
    font-size: 11px;
    color: #7a8ca5;
}
.teams-chat-item .teams-chat-members {
    font-size: 11px;
    color: #4f6a89;
    line-height: 1.2;
}
.teams-chat-item.active {
    border-color: #2e6fb8;
    background: #eef6ff;
}
.teams-chat-item.unread {
    border-color: #2f72bf;
    background: #f4f9ff;
}
.teams-chat-item.unread small {
    color: #153a62;
    font-weight: 600;
}
.teams-chat-item .teams-chat-unread-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #1f74d0;
    margin-left: 6px;
    vertical-align: middle;
}
.teams-widget-messages {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 0;
}
.teams-widget-chat-head {
    padding: 10px 12px;
    border-bottom: 1px solid #edf2f8;
    font-weight: 700;
    color: #14355a;
}
.teams-message-list {
    overflow: auto;
    padding: 10px 12px;
    background: #f7faff;
    display: grid;
    gap: 8px;
}
.teams-msg {
    border-radius: 10px;
    padding: 8px 10px;
    max-width: 85%;
}
.teams-msg.mine {
    margin-left: auto;
    background: #ddf3ff;
    border: 1px solid #b8e0f4;
}
.teams-msg.other {
    margin-right: auto;
    background: #fff;
    border: 1px solid #d9e3f2;
}
.teams-msg-meta {
    font-size: 11px;
    color: #63778f;
    margin-bottom: 4px;
}
.teams-msg-body {
    font-size: 13px;
    color: #142b46;
    white-space: pre-wrap;
    word-break: break-word;
}
.teams-msg-files {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.teams-msg-file {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid #cfdcf0;
    background: #f6f9ff;
    color: #1e4f85;
    text-decoration: none;
}
.teams-msg-file:hover {
    border-color: #2f74c4;
}
.teams-send-form {
    border-top: 1px solid #edf2f8;
    padding: 10px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: end;
    background: #fff;
}
.teams-send-form textarea {
    min-height: 42px;
    resize: vertical;
}

@media (max-width: 1100px) {
    .topbar {
        text-align: left;
    }
    .topbar-main {
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
    }
    .topbar-sub {
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
    }
    .userbox { text-align: right; margin-left: auto; }
    .cards.two, .cards.three, .grid.two, .grid.three { grid-template-columns: 1fr; }
    .container { margin-top: 8px; padding-top: 8px; }
    .quick-actions { justify-content: center; flex-wrap: wrap; width: 100%; }
    .quick-link { width: auto; max-width: none; text-align: center; }
    .od-toolbar { grid-template-columns: 1fr 1fr; }
    .teams-widget {
        right: 10px;
        left: 10px;
        width: auto;
        height: min(72vh, 640px);
    }
}

@media (max-width: 960px) {
    .menu-toggle-btn { display: inline-flex; }
    .topnav {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    .topnav.mobile-open { display: flex; }
    .topnav > a,
    .nav-group-toggle { width: 100%; justify-content: space-between; }
    .nav-group { width: 100%; }
    .nav-group-menu {
        position: static;
        border: 1px dashed #cfdaea;
        box-shadow: none;
        margin-top: 6px;
    }
    .nav-group:hover .nav-group-menu { display: none; }
    .nav-group.open .nav-group-menu { display: grid; }

    .login-page {
        justify-content: center;
        align-items: center;
    }
    .login-shell {
        grid-template-columns: 1fr;
        border-radius: 16px;
        min-height: calc(100vh - 24px);
    }
    .login-card { order: 1; }
    .login-brand { order: 2; }
}

@media (max-width: 640px) {
    .topbar {
        padding: 8px 10px 10px;
        gap: 8px;
    }
    .topbar-main {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
    }
    .brand {
        justify-content: flex-start;
        gap: 6px;
        min-width: 0;
    }
    .brand img { width: 86px; }
    .userbox {
        text-align: right;
        min-width: 0;
    }
    .userbox strong { font-size: 13px; }
    .userbox small { font-size: 11px; }
    .topbar-sub {
        gap: 6px;
        padding-top: 6px;
        align-items: center;
        flex-wrap: nowrap;
        justify-content: space-between;
    }
    .menu-toggle-btn {
        align-self: auto;
        justify-content: center;
        min-width: 86px;
        padding: 7px 9px;
        font-size: 13px;
        flex: 0 0 auto;
    }
    .quick-actions {
        width: auto;
        min-width: 0;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        flex-wrap: nowrap;
        gap: 6px;
        flex: 1 1 auto;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 2px;
        scrollbar-width: thin;
    }
    .quick-link {
        width: auto;
        flex: 0 0 auto;
        max-width: none;
        padding: 8px 6px;
        font-size: 12px;
        text-align: center;
        line-height: 1.1;
    }
    .quick-link-alert {
        justify-content: center;
    }
    .login-page { padding: 10px; }
    .login-shell { min-height: calc(100vh - 20px); border-radius: 12px; }
    .login-card { padding: 16px; }
    .login-brand { padding: 16px; }
    .brand-logo { width: 84px; height: 84px; }
    .teams-fab {
        right: 12px;
        bottom: 12px;
        padding: 10px 12px;
    }
    .teams-widget {
        right: 0;
        left: 0;
        bottom: 0;
        height: calc(100dvh - 70px);
        border-radius: 14px 14px 0 0;
        border-left: none;
        border-right: none;
    }
    .teams-widget-body {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
        height: calc(100% - 48px);
    }
    .teams-widget-chats {
        border-right: none;
        border-bottom: none;
        height: 100%;
    }
    .teams-widget-messages {
        height: 100%;
    }
    .teams-widget:not(.mobile-chat-open) .teams-widget-messages {
        display: none;
    }
    .teams-widget.mobile-chat-open .teams-widget-chats {
        display: none;
    }
    .teams-mobile-back-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .teams-widget-search-wrap,
    .teams-widget-newchat {
        padding-left: 8px;
        padding-right: 8px;
    }
    .teams-chat-item {
        padding: 7px 8px;
    }
}
