@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Montserrat:wght@600;700;800&display=swap");

:root {
    --bg: #efe7dc;
    --panel: rgba(255, 255, 255, 0.92);
    --border: #d8c8b2;
    --text: #203142;
    --muted: #566173;
    --brand: #0a5f8f;
    --brand-soft: #dceefc;
    --ok: #155a35;
    --ok-bg: #d9f4e2;
    --error: #8f2523;
    --error-bg: #fbe4df;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Manrope", "Noto Sans Armenian", "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    background-image:
        radial-gradient(circle at 8% 10%, rgba(202, 106, 49, 0.2), transparent 36%),
        radial-gradient(circle at 92% 12%, rgba(10, 95, 143, 0.2), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(245, 237, 226, 0.9)),
        url("yerevan-pattern.svg");
    background-repeat: no-repeat;
    background-size: auto, auto, auto, cover;
    background-attachment: fixed;
    min-height: 100vh;
}

a {
    color: var(--brand);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.container {
    width: min(1160px, calc(100% - 2rem));
    margin-inline: auto;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(255, 252, 247, 0.78);
    border-bottom: 1px solid rgba(120, 94, 67, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 6px 18px rgba(44, 55, 72, 0.08);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    gap: 1rem;
}

.brand {
    color: var(--text);
    text-decoration: none;
    font-family: "Montserrat", "Manrope", sans-serif;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.menu {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.menu a {
    text-decoration: none;
    color: var(--brand);
    font-weight: 700;
    border-radius: 999px;
    padding: 0.25rem 0.62rem;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.menu a:hover {
    background: rgba(10, 95, 143, 0.1);
    color: #074569;
}

.menu .inline-form .link-button {
    background: none;
    border: none;
    box-shadow: none;
    color: var(--brand);
    font-weight: 700;
    padding: 0.25rem 0.62rem;
    border-radius: 999px;
    transform: none;
}

.menu .inline-form .link-button:hover {
    background: rgba(10, 95, 143, 0.1);
    color: #074569;
}

.menu-user {
    color: var(--muted);
}

.menu-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.menu-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(120, 94, 67, 0.25);
    background: #fff;
}

.inline-form {
    margin: 0;
    display: inline;
}

.link-button {
    border: none;
    background: none;
    color: var(--brand);
    cursor: pointer;
    font: inherit;
    padding: 0;
    font-weight: 600;
}

.page {
    padding-block: 1.75rem 2.2rem;
}

.flash {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-weight: 600;
    box-shadow: 0 8px 16px rgba(38, 48, 60, 0.06);
}

.flash-success {
    border-color: #86efac;
    background: var(--ok-bg);
    color: var(--ok);
}

.flash-error {
    border-color: #fca5a5;
    background: var(--error-bg);
    color: var(--error);
}

.flash-info {
    border-color: #93c5fd;
    background: #dbeafe;
    color: #1e3a8a;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1.05rem;
    margin-bottom: 1rem;
    box-shadow: 0 14px 28px rgba(44, 55, 72, 0.08);
    backdrop-filter: blur(3px);
}

.panel h1,
.panel h2,
.panel h3 {
    margin-top: 0;
    font-family: "Montserrat", "Manrope", sans-serif;
    letter-spacing: 0.01em;
}

form {
    display: grid;
    gap: 0.8rem;
}

label {
    font-weight: 600;
    display: block;
    margin-bottom: 0.35rem;
}

.permission-grid {
    display: grid;
    gap: 0.5rem;
}

@media (min-width: 760px) {
    .permission-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.62rem;
    border: 1px solid rgba(120, 94, 67, 0.24);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.7);
}

.permission-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
}

.permission-grid-compact {
    margin-top: 0.45rem;
}

@media (min-width: 760px) {
    .permission-grid-compact {
        grid-template-columns: 1fr;
    }
}

.permission-item-compact {
    padding: 0.36rem 0.5rem;
    font-size: 0.86rem;
}

.share-perms-form {
    margin-top: 0.45rem;
    display: grid;
    gap: 0.5rem;
}

.share-settings {
    margin-top: 0.4rem;
}

.share-settings-toggle {
    display: inline-block;
    cursor: pointer;
    border: 1px solid rgba(120, 94, 67, 0.25);
    background: rgba(255, 255, 255, 0.92);
    color: var(--text);
    border-radius: 10px;
    padding: 0.4rem 0.65rem;
    font-weight: 700;
    font-size: 0.86rem;
    user-select: none;
}

.share-settings-toggle::-webkit-details-marker {
    display: none;
}

.share-settings[open] .share-settings-toggle {
    margin-bottom: 0.45rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="file"],
textarea,
select {
    width: 100%;
    padding: 0.62rem 0.7rem;
    border: 1px solid rgba(120, 94, 67, 0.25);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    font: inherit;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="file"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: rgba(10, 95, 143, 0.6);
    box-shadow: 0 0 0 3px rgba(10, 95, 143, 0.16);
}

textarea {
    min-height: 110px;
    resize: vertical;
}

.btn,
button[type="submit"] {
    border: 1px solid transparent;
    background: linear-gradient(135deg, #0a5f8f, #0c79b3);
    color: #fff;
    padding: 0.62rem 0.9rem;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 10px 20px rgba(10, 95, 143, 0.28);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.btn:hover,
button[type="submit"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 24px rgba(10, 95, 143, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(120, 94, 67, 0.25);
    color: var(--text);
    box-shadow: none;
}

.btn-danger {
    background: linear-gradient(135deg, #aa2a24, #c83c34);
    box-shadow: 0 10px 20px rgba(170, 42, 36, 0.25);
}

.actions {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

th,
td {
    text-align: left;
    border-bottom: 1px solid var(--border);
    padding: 0.7rem 0.5rem;
    vertical-align: top;
}

tbody tr:hover {
    background: rgba(10, 95, 143, 0.05);
}

th {
    color: var(--muted);
    font-size: 0.87rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.grid-2 {
    display: grid;
    gap: 1rem;
}

/* Job page split layout: content left, chat right */
.job-work-layout {
    display: grid;
    gap: 1rem;
    align-items: start;
}

.job-work-main,
.job-work-chat {
    min-width: 0;
}

@media (min-width: 1024px) {
    .job-work-layout {
        grid-template-columns: minmax(0, 1fr) clamp(340px, 34vw, 430px);
        align-items: start;
    }

    .job-work-chat .panel-chat {
        position: sticky;
        top: 1rem;
    }

    .job-work-chat .chat-shell {
        max-width: none;
        margin-inline: 0;
    }
}

@media (min-width: 920px) {
    .grid-2 {
        grid-template-columns: 2fr 1fr;
    }
}

@media (min-width: 1024px) {
    .job-work-main .grid-2 {
        grid-template-columns: 1fr;
    }
}

.meta {
    color: var(--muted);
    font-size: 0.93rem;
}

.tag {
    display: inline-block;
    background: var(--brand-soft);
    color: var(--brand);
    border-radius: 999px;
    padding: 0.22rem 0.62rem;
    font-weight: 700;
    font-size: 0.82rem;
}

.auth-card {
    max-width: 520px;
    margin-inline: auto;
}

.profile-avatar-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
    margin-bottom: 0.8rem;
}

.profile-avatar-lg {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
    background: #fff;
}

.panel-chat {
    padding-bottom: 1.2rem;
}

.chat-shell {
    max-width: 560px;
    margin-inline: auto;
    border: 1px solid #dde5f1;
    border-radius: 24px;
    background: #f2f5fa;
    overflow: hidden;
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.13);
}

.chat-topbar {
    display: flex;
    align-items: center;
    gap: 0.72rem;
    padding: 0.78rem 0.95rem;
    background: #fff;
    border-bottom: 1px solid #e3e9f2;
}

.chat-topbar-avatars {
    display: flex;
    align-items: center;
}

.chat-topbar-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    background: #dbe6f4;
    margin-left: -8px;
}

.chat-topbar-avatar:first-child {
    margin-left: 0;
}

.chat-topbar-title {
    font-size: 0.97rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.chat-topbar-sub {
    margin-top: 0.12rem;
    font-size: 0.78rem;
    color: #64748b;
}

.chat-messages {
    height: 430px;
    overflow-y: auto;
    padding: 0.9rem;
    border-bottom: 1px solid #e3e9f2;
    background: linear-gradient(180deg, #f8fafd, #eef3f9);
}

.chat-empty {
    color: var(--muted);
    font-size: 0.93rem;
}

.chat-message {
    max-width: 84%;
    margin-bottom: 0.74rem;
}

.chat-message.mine {
    margin-left: auto;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.42rem;
}

.chat-message.mine .chat-header {
    justify-content: flex-end;
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #d2dae7;
    background: #fff;
}

.chat-user {
    font-size: 0.74rem;
    font-weight: 700;
    color: #475569;
    max-width: calc(100% - 26px);
    overflow-wrap: anywhere;
}

.chat-mention-flag {
    font-size: 0.68rem;
    color: #854d0e;
    background: #fde68a;
    border-radius: 999px;
    padding: 0.08rem 0.38rem;
    font-weight: 700;
}

.chat-message.mine .chat-user {
    color: rgba(255, 255, 255, 0.95);
}

.chat-message.mine .chat-avatar {
    border-color: rgba(255, 255, 255, 0.58);
    background: rgba(255, 255, 255, 0.2);
}

.chat-bubble {
    padding: 0.62rem 0.82rem;
    border-radius: 18px;
    border-bottom-left-radius: 8px;
    background: #e8edf4;
    color: #0f172a;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.05);
}

.chat-message.mine .chat-bubble {
    background: #0b84ff;
    color: #fff;
    border-bottom-right-radius: 8px;
    border-bottom-left-radius: 18px;
}

.chat-message.mention-me .chat-bubble {
    box-shadow: inset 0 0 0 2px rgba(245, 158, 11, 0.45);
}

.chat-message.reply-target .chat-bubble {
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.24);
}

.chat-reply {
    margin-bottom: 0.42rem;
    padding: 0.28rem 0.58rem;
    background: #f1f5f9;
    color: #334155;
    font-size: 0.8rem;
    border-radius: 6px;
    overflow-wrap: anywhere;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-message.mine .chat-reply {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.chat-body {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    font-size: 0.99rem;
    line-height: 1.34;
}

.chat-attachment {
    margin-top: 0.44rem;
    padding: 0.34rem 0.5rem;
    border: 1px dashed rgba(14, 116, 144, 0.35);
    background: rgba(186, 230, 253, 0.48);
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    max-width: 100%;
}

.chat-message.mine .chat-attachment {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.52);
}

.chat-attachment-link {
    color: inherit;
    font-size: 0.83rem;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.chat-attachment-meta {
    font-size: 0.72rem;
    opacity: 0.92;
}

.chat-actions {
    margin-top: 0.2rem;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.chat-message:hover .chat-actions,
.chat-message.reply-target .chat-actions {
    opacity: 1;
}

.chat-reply-btn {
    font-size: 0.72rem;
    color: #0c4a6e;
}

.chat-time {
    margin-top: 0.23rem;
    padding-inline: 0.12rem;
    font-size: 0.68rem;
    color: #778397;
}

.chat-message.mine .chat-time {
    text-align: right;
}

.chat-message.mine .chat-actions {
    text-align: right;
}

.chat-form {
    margin: 0.7rem;
    padding: 0.62rem 0.72rem 0.42rem;
    background: #fff;
    border: 2px solid #0b84ff;
    border-radius: 18px;
}

.chat-form textarea {
    min-height: 58px;
    max-height: 140px;
    resize: vertical;
    border: none;
    background: transparent;
    padding: 0;
}

.chat-form textarea:focus {
    outline: none;
}

.chat-compose-row {
    margin-top: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.chat-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid #d2dae7;
    background: #fff;
    color: #334155;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
}

.chat-file-input {
    display: none;
}

.chat-attachment-name {
    flex: 1;
    min-width: 0;
    font-size: 0.74rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-send-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: #0b84ff;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
}

.chat-send-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.chat-status {
    min-height: 1.15em;
    margin-top: 0.22rem;
    font-size: 0.74rem;
    color: #64748b;
}

@media (max-width: 900px) {
    body {
        background-attachment: scroll;
        background-size: auto, auto, auto, 190% auto;
    }

    .topbar {
        position: static;
    }

    .menu {
        row-gap: 0.35rem;
    }

    .panel {
        border-radius: 14px;
    }
}
