/* Cores e medidas copiadas da tela /Ticket/Edit do Movidesk (via Chrome DevTools). */
:root {
    --md-blue: #1e88e5;
    --md-link: #1890ff;
    --md-text: #5f5f5f;
    --md-text-strong: #424242;
    --md-sidebar: #d6d4d4;
    --md-topbar: #fafafa;
    --md-component: #f0f0f0;
    --md-input: #f1f1f1;
    --md-border: #d9d9d9;
    --md-requester: #d4dfe6;
    --md-orange: #ffa726;
    --md-green: #4caf50;
    --md-alert-bg: #eeeeee;
    --sidebar-w: 50px;
    --topbar-h: 53px;
    --panel-w: 352px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    font-family: Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: var(--md-text);
    background: #fff;
    overflow: hidden;
}

a { color: var(--md-link); text-decoration: none; }
button { font-family: inherit; }

/* ---------- Menu lateral ---------- */
.side-menu {
    position: fixed; inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--md-sidebar);
    display: flex; flex-direction: column; align-items: center;
    z-index: 3;
}
.side-menu a { color: #37474f; font-size: 18px; width: 100%; text-align: center; padding: 9px 0; display: block; cursor: pointer; }
.side-menu a:hover, .side-menu a.active { color: var(--md-blue); }
.side-logo { padding: 10px 0 !important; }
.side-logo img { width: 30px; height: 30px; display: block; margin: 0 auto; }
.side-menu nav { display: flex; flex-direction: column; width: 100%; }
.side-bottom { margin-top: auto; width: 100%; padding-bottom: 12px; }
.side-bottom .boxed { border: 2px solid #37474f; border-radius: 4px; width: 32px; margin: 0 auto 10px; padding: 4px 0; }

/* ---------- Barra superior ---------- */
.top-bar {
    position: fixed; top: 0; left: var(--sidebar-w); right: 0;
    height: var(--topbar-h);
    background: var(--md-topbar);
    border-bottom: 4px solid var(--md-blue);
    display: flex; align-items: stretch; justify-content: space-between;
    z-index: 2;
}
.tabs { display: flex; align-items: stretch; }
.tab {
    display: flex; align-items: center; gap: 4px;
    width: 188px; padding: 0 28px 0 10px;
    background: var(--md-blue); color: #fff; font-size: 15px; font-weight: 500;
    white-space: nowrap; overflow: hidden;
}
.tab span { overflow: hidden; text-overflow: ellipsis; }
.tab-new { display: flex; align-items: center; justify-content: center; width: 52px; background: #e8e8e8; color: #9e9e9e; font-size: 18px; }
.top-icons { display: flex; align-items: center; gap: 22px; padding-right: 6px; color: #9e9e9e; font-size: 19px; }
.top-icons .chat { color: #e53935; }
.avatar-top { width: 40px; height: 40px; border-radius: 50%; background: #cfd8dc; color: #90a4ae; display: flex; align-items: flex-end; justify-content: center; font-size: 30px; overflow: hidden; }

/* ---------- Localize seu ticket (lupa da barra superior) ---------- */
.top-search { position: relative; display: flex; align-items: center; }
.top-search input {
    width: 0; padding: 4px 0; border: 0; border-bottom: 1px solid transparent;
    background: transparent; font: inherit; font-size: 15px; color: var(--md-text-strong); outline: none;
    transition: width .2s ease, padding .2s ease;
}
.top-search.open input { width: 250px; padding: 4px 6px; border-bottom-color: #bdbdbd; }
.top-search button { border: 0; background: transparent; color: inherit; font-size: 19px; padding: 0 0 0 8px; cursor: pointer; }
.search-results {
    position: absolute; top: calc(100% + 12px); left: 0; z-index: 10;
    width: 285px; max-height: calc(100vh - 80px); overflow-y: auto;
    background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
    padding: 0 10px; font-size: 14px; color: var(--md-text-strong);
}
.search-results .ticket-container { display: block; padding: 12px 0; border-bottom: 1px solid #e0e0e0; color: var(--md-text-strong); }
.search-results .ticket-container:hover { background: #f5f5f5; }
.search-results .item-number { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.search-results .item-subject { font-size: 15px; line-height: 1.35; }
.search-results .item-client { font-size: 11px; line-height: 1.5; margin-top: 4px; }
.search-results .item-text { font-size: 13px; margin-top: 6px; color: var(--md-text); }
.search-results em { background: #c6e03a; font-style: italic; }
.search-loader, .search-message { padding: 14px 0; color: var(--md-text); font-size: 13px; }
.search-message.error { color: #c62828; }

/* ---------- Área do ticket ---------- */
.ticket {
    position: fixed; top: var(--topbar-h); left: var(--sidebar-w); right: 0; bottom: 0;
    display: flex; flex-direction: column;
    padding: 10px 15px 0 13px;
}
.ticket-toolbar { display: flex; justify-content: space-between; align-items: center; min-height: 46px; }
.breadcrumb { display: flex; align-items: center; gap: 6px; color: var(--md-text); }
.breadcrumb .sep { color: var(--md-blue); font-size: 16px; margin: 0 4px; }
.breadcrumb strong { color: var(--md-text-strong); }
.toolbar-actions { display: flex; align-items: center; gap: 6px; }
.btn-eye { width: 36px; height: 36px; border: 0; border-radius: 3px; background: var(--md-orange); color: #fff; font-size: 18px; }
.status-select {
    display: flex; justify-content: space-between; align-items: center;
    width: 282px; height: 36px; padding: 0 12px;
    background: var(--md-component); border-radius: 3px; font-weight: 700; color: var(--md-text-strong);
}
.status-select i { font-size: 9px; color: #9e9e9e; }
.btn-options { height: 36px; padding: 1px 6px; border: 0; border-radius: 3px; background: var(--md-component); color: var(--md-text); font-weight: 700; font-size: 14px; cursor: pointer; }
.btn-options.flat { background: transparent; height: auto; }

.ticket-body { flex: 1; display: flex; gap: 30px; min-height: 0; }

/* ---------- Painel de classificação ---------- */
.classification { width: var(--panel-w); flex: none; display: flex; flex-direction: column; min-height: 0; }
.visibility-tabs { display: flex; justify-content: center; gap: 30px; padding: 10px 0 12px; }
.visibility-tabs label { font-size: 15px; font-weight: 500; color: var(--md-text-strong); padding: 0 0 4px; border-bottom: 2px solid transparent; cursor: pointer; }
.visibility-tabs label.active { border-bottom-color: var(--md-blue); padding: 0 15px 4px 0; }
.classification-scroll { flex: 1; overflow-y: auto; padding: 0 14px 30px 0; }

.field { margin-bottom: 18px; }
.field > label, .label-row label { display: block; font-size: 14px; color: var(--md-text); padding-bottom: 6px; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; }
.input-link { font-size: 11px; color: var(--md-blue); }
.field-row { display: flex; gap: 16px; }
.field-row .field { flex: 1; min-width: 0; }
.hint { margin: 6px 0 0; font-size: 11px; color: var(--md-text); max-width: 110px; }
.hint i { color: #616161; }

.md-select, .md-input {
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
    min-height: 36px; padding: 6px 12px;
    background: #fff; border: 1px solid var(--md-border); border-radius: 2px;
    font-size: 12px; color: var(--md-text);
}
.md-select > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.md-select i.bi-caret-down-fill { font-size: 8px; color: #9e9e9e; flex: none; }
.md-select.small { width: 104px; }
.md-select.disabled { background: var(--md-component); color: #9e9e9e; }
.md-select.service > span { display: flex; flex-direction: column; white-space: normal; }
.md-select.service strong { color: var(--md-text-strong); font-weight: 700; }
.md-select.service small { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.urgency-dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: #32cd32; vertical-align: -1px; }
.input-with-icon { display: flex; align-items: center; gap: 8px; }
.input-with-icon .md-input { flex: 1; }
.input-with-icon i { color: #757575; }

.requester { position: relative; margin-top: 10px; padding: 9px 10px; border-radius: 3px; background: var(--md-component); font-size: 12px; line-height: 1.6; }
.requester.active { background: var(--md-requester); }
.requester-name { font-size: 14px; }
.requester .remove { position: absolute; top: 8px; right: 8px; font-size: 14px; color: #757575; }

.card-jira { margin-bottom: 18px; border: 1px solid #eee; border-radius: 2px; }
.card-jira-title { display: flex; justify-content: space-between; padding: 8px; background: var(--md-component); font-weight: 500; color: var(--md-text-strong); font-size: 15px; }
.card-jira-body { padding: 10px; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-jira-body a { font-weight: 700; }
.card-jira-body strong { color: var(--md-text-strong); }

.cc-list { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.cc-list li { display: flex; justify-content: space-between; padding: 3px 0; }
.cc-list i { color: #757575; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { background: #e3f2fd; color: var(--md-blue); padding: 2px 8px; border-radius: 10px; font-size: 12px; }

/* ---------- Conteúdo ---------- */
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.ticket-heading { padding: 12px 0 10px; border-bottom: 2px solid #eee; }
.ticket-heading h1 { margin: 0 0 2px; font-size: 16px; font-weight: 700; color: var(--md-text-strong); }
.ticket-heading p { margin: 0; font-size: 12px; color: var(--md-text-strong); }
.ticket-heading strong { color: var(--md-text-strong); }
.content-scroll { flex: 1; overflow-y: auto; padding: 8px 5px 40px 0; }

.alert-finished { background: var(--md-alert-bg); padding: 12px 10px; font-size: 14px; color: var(--md-text-strong); border-radius: 2px; }
.btn-reopen { display: block; margin-top: 6px; padding: 8px 12px; border: 0; border-radius: 2px; background: var(--md-green); color: #fff; font-weight: 700; font-size: 14px; cursor: not-allowed; }

.relationships { display: flex; align-items: center; gap: 70px; padding: 14px 0 6px; font-size: 12px; border-bottom: 1px solid #eee; }
.relationships-info { font-style: italic; color: var(--md-text); flex: 1; }
.relationships-list { padding: 8px 0; font-size: 12px; }
.relationships-list .rel-kind { display: inline-block; min-width: 40px; color: #9e9e9e; }

.view-filters { display: flex; justify-content: flex-end; align-items: center; gap: 16px; padding: 18px 0 8px; font-size: 13px; }
.view-filters > span { font-size: 15px; }
.view-filters label { display: flex; align-items: center; gap: 5px; cursor: pointer; }
.view-filters input { accent-color: #424242; width: 14px; height: 14px; }

.action-list { position: relative; }
.action-item { display: flex; gap: 20px; margin-bottom: 10px; position: relative; }
.action-item::before { content: ""; position: absolute; left: 19px; top: 40px; bottom: -10px; width: 1px; background: #e0e0e0; }
.action-item:last-child::before { display: none; }
.action-item.hidden { display: none; }
.action-avatar {
    flex: none; width: 40px; height: 40px; border-radius: 50%;
    background: #cfd8dc; color: #fff; font-weight: 700; font-size: 14px;
    display: flex; align-items: center; justify-content: center; z-index: 1;
}
.action-item-content-container { flex: 1; min-width: 0; background: var(--md-component); border-radius: 3px; }
.action-item.internal .action-item-content-container { background: #fff8e1; }
.action-item-title {
    display: flex; align-items: center; gap: 0;
    min-height: 30px; border-bottom: 2.4px solid var(--md-blue);
}
.action-item.internal .action-item-title { border-bottom-color: var(--md-orange); }
.createdBy { padding: 0 10px; font-weight: 700; font-size: 14px; color: var(--md-text-strong); }
.action-date { font-size: 12px; color: var(--md-text); }
.action-type { margin-left: 10px; font-size: 12px; color: var(--md-text); }
.action-number { margin-left: auto; padding-right: 10px; font-weight: 700; color: var(--md-text-strong); }
.action-tags { display: flex; align-items: center; gap: 6px; padding: 6px 0 0; color: #616161; font-size: 14px; }
.edit-tags { color: var(--md-blue); }
.action-item-content { padding: 10px; font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; color: var(--md-text); }
.action-item-content p { margin: 0; }
.action-item-content img { max-width: 100%; height: auto; }
.action-item-content table { border-collapse: collapse; max-width: 100%; }
.action-item-content td, .action-item-content th { border: 1px solid #ddd; padding: 4px; }
.action-attachments { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 0 10px 10px; font-size: 12px; }
.empty { color: #9e9e9e; font-style: italic; }

/* ---------- Mensagens (ticket não encontrado, Movidesk indisponível) ---------- */
.ticket-message {
    max-width: 520px; margin: 80px auto 0; padding: 36px 32px;
    text-align: center; background: #fff;
    border-top: 4px solid var(--md-blue); box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
}
.ticket-message-logo { width: 56px; height: 56px; }
.ticket-message h1 { margin: 14px 0 8px; font-size: 20px; font-weight: 700; color: var(--md-text-strong); }
.ticket-message p { margin: 0 0 6px; line-height: 1.5; }
.ticket-message-hint { font-size: 13px; color: #757575; }
.ticket-message-form { display: flex; justify-content: center; gap: 8px; margin: 22px 0 12px; }
.ticket-message-form input { width: 200px; padding: 8px 10px; border: 1px solid var(--md-border); border-radius: 2px; font: inherit; }
.ticket-message-form button { padding: 8px 16px; border: 0; border-radius: 2px; background: var(--md-blue); color: #fff; font-weight: 700; cursor: pointer; }
.ticket-message-search { font-size: 13px; }

@media (max-width: 900px) {
    html, body { overflow: auto; }
    .ticket { position: static; margin: var(--topbar-h) 0 0 var(--sidebar-w); }
    .ticket-body { flex-direction: column; }
    .classification { width: 100%; }
    .status-select { width: 150px; }
    .relationships { gap: 12px; flex-wrap: wrap; }
}

/* ---------- Usuário logado (avatar da barra superior) ---------- */
.user-menu { position: relative; }
button.avatar-top { border: 0; padding: 0; cursor: pointer; align-items: center; font: inherit; font-size: 15px; font-weight: 500; color: #fff; background: var(--md-blue); }
button.avatar-top img { width: 100%; height: 100%; object-fit: cover; }
.user-dropdown {
    position: absolute; right: 0; top: 48px; z-index: 30; min-width: 240px; padding: 14px 16px;
    display: flex; flex-direction: column; gap: 4px; background: #fff; border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .2); font-size: 13px; color: var(--md-text);
}
.user-dropdown[hidden] { display: none; }
.user-dropdown strong { color: var(--md-text-strong); font-size: 14px; }
.user-dropdown .user-session { margin-top: 4px; font-size: 12px; color: #9e9e9e; }
.user-dropdown form { margin: 8px -16px -14px; border-top: 1px solid #eee; }
.user-dropdown form button {
    width: 100%; padding: 10px 16px; border: 0; background: transparent; text-align: left;
    font: inherit; color: var(--md-text-strong); cursor: pointer;
}
.user-dropdown form button:hover { background: var(--md-component); }

/* ---------- Tela de login ---------- */
body.login-page { display: block; background: #eef1f4; overflow: auto; }
.login-wrapper { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 16px; }
.login-card {
    width: 100%; max-width: 380px; padding: 36px 40px; background: #fff; border: 1px solid #e0e0e0; border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .08); display: flex; flex-direction: column; align-items: center; gap: 18px;
}
.login-brand { display: flex; align-items: center; gap: 12px; width: 100%; }
.login-brand img { border-radius: 8px; }
.login-brand h1 { margin: 0; font-size: 16px; font-weight: 700; color: var(--md-text-strong); }
.login-brand p { margin: 2px 0 0; font-size: 12px; color: #9e9e9e; }
.login-divider { width: 100%; height: 1px; background: #e0e0e0; }
.login-instruction { margin: 0; font-size: 14px; color: var(--md-text); }
.login-instruction[hidden], .google-btn-wrap[hidden], .login-loading[hidden], .login-error[hidden] { display: none; }
.google-btn-wrap { display: flex; justify-content: center; width: 100%; min-height: 44px; }
.login-loading { display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 13px; color: var(--md-text); }
.login-spinner { width: 28px; height: 28px; border: 3px solid #e0e0e0; border-top-color: var(--md-blue); border-radius: 50%; animation: login-spin .8s linear infinite; }
@keyframes login-spin { to { transform: rotate(360deg); } }
.login-notice { width: 100%; margin: 0; padding: 10px 12px; border-radius: 4px; background: #e3f2fd; color: #1565c0; font-size: 13px; text-align: center; }
.login-error { width: 100%; margin: 0; padding: 10px 12px; border-radius: 4px; background: #ffebee; color: #c62828; font-size: 13px; text-align: center; }
.login-hint { margin: 0; font-size: 12px; color: #9e9e9e; text-align: center; }
.login-footer { margin: 0; font-size: 12px; color: #9e9e9e; }
