*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body {
  font-family: "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
  color: #202124; background: #f6f8fc; height: 100vh; display: flex;
}

#login { display: flex; align-items: center; justify-content: center; flex: 1; }
.login-card { width: 360px; background: #fff; border-radius: 12px; padding: 32px; box-shadow: 0 1px 4px rgba(0,0,0,0.12); display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { font-size: 20px; font-weight: 500; }
.muted { color: #5f6368; font-size: 13px; }
.small { font-size: 12px; }

input, textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid #e0e0e0; border-radius: 6px;
  font-size: 14px; font-family: inherit; background: #fff; color: #202124;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: #1a73e8; box-shadow: 0 0 0 2px rgba(26,115,232,0.15); }
textarea { resize: vertical; line-height: 1.6; }

button {
  padding: 8px 20px; border-radius: 24px; font-size: 13px; font-weight: 500;
  cursor: pointer; border: 1px solid #dadce0; background: #fff; color: #202124; font-family: inherit;
}
button:hover { background: #f1f3f4; }
button.primary { background: #1a73e8; color: #fff; border-color: #1a73e8; }
button.primary:hover { background: #1557b0; }
button.full { width: 100%; margin: 8px 0; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.ghost { border: none; background: transparent; color: #5f6368; }

#app { flex: 1; display: flex; flex-direction: column; }
#tabs { display: flex; border-bottom: 1px solid #e0e0e0; background: #fff; align-items: center; }
.tab { padding: 12px 24px; border: none; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: #5f6368; }
.tab.active { color: #1a73e8; border-bottom-color: #1a73e8; }
#tabs .ghost { margin-left: auto; }

.tab-body { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 16px 24px; overflow-y: auto; }
.emails-layout { display: flex; flex: 1; min-height: 0; gap: 16px; }
.sidebar { width: 320px; min-width: 320px; background: #fff; border: 1px solid #e8eaed; border-radius: 8px; display: flex; flex-direction: column; }
.sidebar .muted { padding: 12px 16px 0; }
#companyList { flex: 1; overflow-y: auto; }
.company-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; cursor: pointer; border-left: 3px solid transparent; }
.company-item:hover { background: #f1f3f4; }
.company-item.active { background: #e8f0fe; border-left-color: #1a73e8; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot.generated { background: #34a853; }
.dot.pending { background: #fbbc04; }
.dot.skipped { background: #dadce0; }
.item-text { flex: 1; min-width: 0; }
.item-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-subject { font-size: 12px; color: #5f6368; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-icon::after { content: ""; display: inline-block; width: 14px; height: 14px; background: #5f6368; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21 9l-9-7-9 7v2l9-7 9 7v-2z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21 9l-9-7-9 7v2l9-7 9 7v-2z'/%3E%3C/svg%3E") center / contain no-repeat; }
.lang-badge { font-size: 10px; font-weight: 600; padding: 1px 5px; border-radius: 3px; text-transform: uppercase; }
.lang-badge.en { background: #e8f0fe; color: #1a73e8; }
.lang-badge.pt { background: #fce8e6; color: #c5221f; }

.detail { flex: 1; background: #fff; border: 1px solid #e8eaed; border-radius: 8px; display: flex; flex-direction: column; min-width: 0; }
.placeholder { flex: 1; display: flex; align-items: center; justify-content: center; color: #5f6368; font-size: 14px; }
.detail-form { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 20px 28px; min-width: 0; }
.detail-form label { font-size: 11px; font-weight: 600; color: #5f6368; text-transform: uppercase; letter-spacing: 0.8px; }
.meta { }
.actions { display: flex; gap: 8px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.toolbar h2 { font-size: 16px; font-weight: 500; }
.company-form { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; background: #fafafa; border: 1px solid #e8eaed; border-radius: 8px; padding: 12px; margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #202124; }
.check input { width: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; border: 1px solid #e8eaed; border-radius: 8px; }
th { text-align: left; padding: 8px 12px; color: #5f6368; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid #e8eaed; background: #fafafa; }
td { padding: 8px 12px; border-bottom: 1px solid #e8eaed; vertical-align: middle; }
tr:hover td { background: #f1f3f4; }
.status-generated { color: #34a853; font-weight: 500; }
.status-pending { color: #fbbc04; font-weight: 500; }
.status-skipped { color: #dadce0; font-weight: 500; }
.gen-btn { padding: 4px 12px; }
.delete-btn { padding: 4px 12px; border: 1px solid #ea4335; color: #ea4335; }
.delete-btn:hover { background: #fce8e6; }

.modal { position: fixed; inset: 0; background: rgba(32,33,36,0.5); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-card { background: #fff; border-radius: 12px; padding: 24px; width: 560px; max-width: 90vw; display: flex; flex-direction: column; gap: 12px; }
.modal-card h3 { font-size: 16px; font-weight: 500; }
.modal-actions { display: flex; gap: 8px; }
#importResult { max-height: 200px; overflow-y: auto; }
#importResult ul { margin: 8px 0 0 18px; font-size: 12px; color: #ea4335; }

.error { color: #ea4335; font-size: 13px; }
#toast { position: fixed; bottom: 24px; right: 24px; padding: 12px 24px; border-radius: 8px; color: #fff; font-size: 13px; font-weight: 500; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,0.2); background: #202124; }
#toast.success { background: #34a853; }
#toast.error { background: #ea4335; }
code { font-size: 12px; background: #f1f3f4; border-radius: 4px; padding: 2px 6px; display: inline-block; max-width: 100%; overflow-wrap: anywhere; }