/* ===================================
   SHTranslamax — Stylesheet
   ShowHeroes Brand
   =================================== */

/* --- Reset & Base --- */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --sh-navy: #0B3144;
    --sh-navy-light: #2B4D5E;
    --sh-teal: #00E18C;
    --sh-cream: #f0f2f5;
    --color-surface: #ffffff;
    --color-bg: #f8f9fa;
    --color-border: #d0e0d8;
    --color-border-light: #e0ece8;
    --color-text: #0B3144;
    --color-text-secondary: #2B4D5E;
    --color-text-muted: #6B8A99;
    --color-primary: #00E18C;
    --color-primary-hover: #00C47A;
    --color-primary-light: rgba(0, 225, 140, 0.1);
    --color-success: #22c55e;
    --color-success-light: rgba(34, 197, 94, 0.1);
    --color-danger: #ef4444;
    --color-danger-hover: #dc2626;
    --color-danger-light: #fef2f2;
    --color-warning: #facc15;
    --color-warning-light: #fef3c7;
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(11, 49, 68, 0.05);
    --shadow: 0 1px 3px rgba(11, 49, 68, 0.1), 0 1px 2px rgba(11, 49, 68, 0.06);
    --shadow-lg: 0 4px 12px rgba(11, 49, 68, 0.12);
    --navbar-height: 52px;
    --transition: 150ms ease;
}

html {
    font-size: 14px;
    line-height: 1.5;
}

body {
    font-family: var(--font-stack);
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
    overflow-x: hidden;
}

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

a:hover {
    text-decoration: underline;
    color: var(--sh-teal);
}

/* Screen-reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.hidden {
    display: none !important;
}

/* --- Buttons --- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 0.875rem;
    font-weight: 700;
    font-family: inherit;
    line-height: 1.4;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition), filter var(--transition);
    white-space: nowrap;
    user-select: none;
    min-height: 40px;
}

.btn:focus-visible {
    outline: 2px solid var(--sh-teal);
    outline-offset: 2px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--sh-teal);
    color: var(--sh-navy);
    border-color: var(--sh-teal);
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
}

.btn-secondary {
    background: var(--sh-navy-light);
    color: #ffffff;
    border-color: var(--sh-navy-light);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--sh-navy);
    border-color: var(--sh-navy);
}

.btn-danger {
    background: var(--color-danger);
    color: #ffffff;
    border-color: var(--color-danger);
}

.btn-danger:hover:not(:disabled) {
    background: var(--color-danger-hover);
    border-color: var(--color-danger-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--sh-navy);
    border: 1px solid var(--sh-navy-light);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--sh-cream);
    color: var(--sh-navy);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8125rem;
    min-height: 32px;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--color-text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}

.btn-icon:hover {
    color: var(--color-text);
    background: var(--color-bg-hover, rgba(0, 0, 0, 0.05));
}

.btn-lg {
    min-height: 48px;
    padding: 10px 20px;
    font-size: 1rem;
}

.btn-block {
    display: flex;
    width: 100%;
}

/* --- Forms --- */

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="url"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 7px 10px;
    font-size: 0.875rem;
    font-family: inherit;
    line-height: 1.4;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    transition: border-color var(--transition), box-shadow var(--transition);
    min-height: 40px;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--sh-teal);
    box-shadow: 0 0 0 3px rgba(0, 225, 140, 0.2);
}

input:disabled,
textarea:disabled,
select:disabled {
    background: var(--color-bg);
    color: var(--color-text-muted);
    cursor: not-allowed;
}

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

.form-error {
    color: var(--color-danger);
    font-size: 0.8125rem;
    margin-top: 4px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

/* Checkbox / Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: auto;
    margin: 0;
    min-height: auto;
}

.form-check label {
    margin: 0;
    font-weight: 400;
    color: var(--color-text);
    cursor: pointer;
}

/* --- Navbar --- */

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--navbar-height);
    padding: 0 20px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.navbar-brand {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--sh-navy);
    letter-spacing: -0.02em;
}

.navbar-brand:hover {
    text-decoration: none;
}

.brand-sh {
    color: var(--sh-navy);
}

.brand-name {
    color: var(--sh-teal);
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    padding: 6px 12px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--sh-navy-light);
    border-radius: var(--radius);
    transition: background var(--transition), color var(--transition);
}

.nav-link:hover {
    text-decoration: none;
    background: var(--sh-cream);
    color: var(--sh-navy);
}

.nav-link.active {
    background: rgba(0, 225, 140, 0.1);
    color: var(--sh-teal);
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Project indicator */
.project-indicator {
    display: flex;
    align-items: center;
}

.project-select {
    width: auto;
    min-width: 140px;
    padding: 4px 28px 4px 10px;
    font-size: 0.8125rem;
    font-weight: 500;
    border-color: var(--color-border-light);
    border-radius: var(--radius-sm);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%232B4D5E'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 10px 6px;
    appearance: none;
    cursor: pointer;
    min-height: 32px;
}

/* Branch indicator */
.branch-indicator {
    display: flex;
    align-items: center;
}

.branch-select {
    width: auto;
    min-width: 120px;
    padding: 4px 28px 4px 10px;
    font-size: 0.8125rem;
    border-color: var(--color-border-light);
    border-radius: var(--radius-sm);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%232B4D5E'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 10px 6px;
    appearance: none;
    cursor: pointer;
    min-height: 32px;
}

/* User menu */
.user-menu {
    position: relative;
}

.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--color-text);
    transition: background var(--transition);
}

.user-menu-toggle:hover {
    background: var(--sh-cream);
}

.user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--sh-teal);
    color: var(--sh-navy);
    font-size: 0.75rem;
    font-weight: 700;
}

.user-name {
    font-weight: 500;
}

.user-menu-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    min-width: 160px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    padding: 4px;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 8px 12px;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--color-text);
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: left;
    transition: background var(--transition);
}

.dropdown-item:hover {
    background: var(--sh-cream);
}

/* --- App Shell --- */

.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Main Content --- */

.main-content {
    flex: 1;
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* --- Login Page --- */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--color-bg);
}

.login-card {
    width: 100%;
    max-width: 380px;
    padding: 40px 32px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 4px;
    color: var(--sh-navy);
}

.login-title .brand-sh {
    color: var(--sh-navy);
}

.login-title .brand-name {
    color: var(--sh-teal);
}

.login-subtitle {
    text-align: center;
    color: var(--color-text-muted);
    margin-bottom: 32px;
    font-size: 0.9375rem;
}

/* --- Three-Panel Editor Layout --- */

.editor-layout {
    display: grid;
    grid-template-columns: 280px 1fr 300px;
    gap: 0;
    height: calc(100vh - var(--navbar-height));
    overflow: hidden;
}

.editor-panel {
    overflow-y: auto;
    border-right: 1px solid var(--color-border);
}

.editor-panel:last-child {
    border-right: none;
}

/* Left panel -- Key list */
.key-list-panel {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
}

.key-list-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
}

.key-list-search {
    position: relative;
}

.key-list-search input {
    padding-left: 32px;
}

.key-list-search::before {
    content: "";
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236B8A99'%3E%3Cpath fill-rule='evenodd' d='M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

.key-list-filters {
    display: flex;
    gap: 8px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--color-border-light);
}

.key-list-filters select {
    width: auto;
    font-size: 0.8125rem;
    padding: 3px 8px;
    min-height: 28px;
}

.key-list-items {
    flex: 1;
    overflow-y: auto;
}

.key-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--color-border-light);
    cursor: pointer;
    transition: background var(--transition);
    font-size: 0.8125rem;
}

.key-list-item:hover {
    background: var(--sh-cream);
}

.key-list-item.active {
    background: rgba(0, 225, 140, 0.1);
    border-left: 3px solid var(--sh-teal);
    padding-left: 13px;
}

.key-name-wrap {
    flex: 1;
    overflow: hidden;
    min-width: 0;
}

.key-list-item .key-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.key-preview {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.6875rem;
    color: var(--color-text-muted);
    margin-top: 2px;
    line-height: 1.3;
}

.key-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.key-status-dot.translated {
    background: var(--color-success);
}

.key-status-dot.partial {
    background: var(--color-warning);
}

.key-status-dot.untranslated {
    background: var(--color-text-muted);
}

.key-list-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
}

/* Center panel -- Translation editor */
.translation-editor-panel {
    background: var(--color-surface);
    padding: 24px;
    overflow-y: auto;
}

.translation-key-name {
    font-family: var(--font-mono);
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border-light);
    word-break: break-all;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.key-name-text {
    flex: 1;
    min-width: 0;
}

.key-name-copyable {
    cursor: pointer;
    border-radius: 4px;
    padding: 2px 4px;
    margin: -2px -4px;
    transition: background 150ms ease;
}

.key-name-copyable:hover {
    background: var(--sh-cream);
}

.key-name-edit-btn {
    flex-shrink: 0;
    opacity: 0.4;
    transition: opacity 0.15s;
}

.translation-key-name:hover .key-name-edit-btn {
    opacity: 0.8;
}

.key-name-edit-btn:hover {
    opacity: 1 !important;
}

.key-name-input {
    flex: 1;
    min-width: 0;
    font-family: var(--font-mono);
    font-size: 0.9375rem;
    font-weight: 600;
    padding: 4px 8px;
    border: 1px solid var(--color-primary);
    border-radius: var(--radius);
    outline: none;
}

.key-name-edit-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.translation-field {
    margin-bottom: 20px;
}

.translation-field-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.locale-label {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
}

.locale-label .locale-code {
    background: var(--sh-cream);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    margin-right: 4px;
}

.translation-checks {
    display: flex;
    gap: 12px;
}

.translation-actions {
    display: flex;
    gap: 8px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border-light);
}

/* Right panel -- Sidebar */
.key-sidebar-panel {
    background: var(--color-surface);
    padding: 20px;
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border-light);
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.sidebar-section-subtitle {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.sidebar-job-item {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.sidebar-quick-add-jobs {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-quick-add-btn {
    text-align: left;
    justify-content: flex-start;
    font-size: 0.75rem;
    padding: 4px 8px;
    min-height: auto;
}

.sidebar-job-select {
    width: 100%;
    font-size: 0.75rem;
    padding: 4px 8px;
    min-height: auto;
}

/* --- Tables --- */

.table-container {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--sh-cream);
}

th {
    text-align: left;
    padding: 10px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--color-border);
}

td {
    padding: 12px 16px;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--color-border-light);
}

tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--sh-cream);
}

/* --- Modal --- */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(11, 49, 68, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: none;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: background var(--transition);
}

.modal-close:hover {
    background: var(--sh-cream);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--color-border);
}

/* --- Toast Notifications --- */

.toast-container {
    position: fixed;
    top: 68px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    min-width: 280px;
    max-width: 420px;
    pointer-events: auto;
    animation: toast-in 200ms ease;
}

.toast.toast-success {
    border-left: 4px solid var(--color-success);
}

.toast.toast-error {
    border-left: 4px solid var(--color-danger);
}

.toast.toast-warning {
    border-left: 4px solid var(--color-warning);
}

.toast-dismiss {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 1.125rem;
    padding: 0 4px;
    line-height: 1;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toast.toast-out {
    animation: toast-out 200ms ease forwards;
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateY(12px);
    }
}

/* --- Spinner --- */

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(11, 49, 68, 0.15);
    border-top-color: var(--sh-navy);
    border-radius: 50%;
    animation: spin 600ms linear infinite;
}

.spinner.spinner-dark {
    border-color: rgba(11, 49, 68, 0.15);
    border-top-color: var(--color-text-secondary);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Loading state for content area */
.loading-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--color-text-muted);
    gap: 12px;
}

.loading-container .spinner {
    border-color: rgba(11, 49, 68, 0.1);
    border-top-color: var(--sh-teal);
    width: 24px;
    height: 24px;
}

/* --- Page Headers --- */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--sh-navy);
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin-top: 2px;
}

/* --- Tags --- */

.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 999px;
    background: rgba(0, 225, 140, 0.1);
    color: var(--sh-navy);
    border: 1px solid rgba(0, 225, 140, 0.3);
}

.tag-primary {
    background: rgba(0, 225, 140, 0.1);
    color: var(--sh-navy);
    border-color: rgba(0, 225, 140, 0.3);
}

.tag-success {
    background: var(--color-success-light);
    color: var(--color-success);
    border-color: transparent;
}

.tag-danger {
    background: var(--color-danger-light);
    color: var(--color-danger);
    border-color: transparent;
}

.tag-warning {
    background: var(--color-warning-light);
    color: #92400e;
    border-color: transparent;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* --- Badges / Status --- */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
}

.badge-success {
    background: var(--sh-teal);
    color: var(--sh-navy);
}

.badge-warning {
    background: var(--color-warning-light);
    color: #92400e;
}

.badge-danger {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

.badge-info {
    background: rgba(0, 225, 140, 0.1);
    color: var(--sh-navy);
}

/* --- Merge View --- */

.conflict-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.conflict-header {
    padding: 10px 16px;
    background: var(--color-warning-light);
    border-bottom: 1px solid var(--color-border);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 600;
}

.conflict-values {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.conflict-side {
    padding: 12px 16px;
}

.conflict-side:first-child {
    border-right: 1px solid var(--color-border-light);
}

.conflict-side-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    margin-bottom: 6px;
}

.conflict-side-value {
    font-size: 0.875rem;
    padding: 8px;
    background: var(--sh-cream);
    border-radius: var(--radius-sm);
    word-break: break-word;
}

/* --- Merge Summary --- */

.merge-summary {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.merge-summary-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 24px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    min-width: 100px;
    text-align: center;
    box-shadow: var(--shadow);
}

.merge-summary-count {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--sh-navy);
    margin-bottom: 4px;
}

.merge-summary-label {
    font-size: 0.8125rem;
}

.merge-success-message {
    text-align: center;
}

.conflict-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* --- Empty States --- */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--color-text-muted);
    text-align: center;
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
}

.empty-state-text {
    font-size: 0.875rem;
    max-width: 320px;
}

/* --- Pagination --- */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 24px;
}

.pagination .btn {
    min-width: 36px;
    padding: 6px 10px;
}

.pagination .btn.active {
    background: var(--sh-teal);
    color: var(--sh-navy);
    border-color: var(--sh-teal);
}

.pagination-info {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin: 0 8px;
}

/* --- Utility --- */

.text-muted {
    color: var(--color-text-muted);
}

.text-success {
    color: var(--color-success);
}

.text-danger {
    color: var(--color-danger);
}

.text-mono {
    font-family: var(--font-mono);
}

.text-sm {
    font-size: 0.8125rem;
}

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }

/* --- Copy Button --- */

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 0.75rem;
    background: var(--sh-cream);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: background var(--transition);
}

.copy-btn:hover {
    background: var(--color-border-light);
}

/* --- Progress Bar --- */

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--color-border-light);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--sh-teal);
    border-radius: 999px;
    transition: width 300ms ease;
}

/* --- Unsaved Changes Indicator --- */

.unsaved-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-warning);
    display: inline-block;
}

/* --- Token Display --- */

.token-warning {
    padding: 12px 16px;
    background: var(--color-warning-light);
    border: 1px solid var(--color-warning);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--color-text);
    line-height: 1.5;
}

.token-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--sh-cream);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.token-value {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    word-break: break-all;
    user-select: all;
}

/* --- Editor Layout Adjustments --- */

/* When the editor layout is nested inside main-content, remove padding */
.main-content:has(.editor-layout) {
    padding: 0;
    max-width: none;
}

.key-list-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 16px;
    border-top: 1px solid var(--color-border-light);
}

/* Translation field textarea auto-resize styling */
.translation-field textarea {
    resize: none;
    overflow: hidden;
    min-height: 60px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.translation-field textarea:focus {
    min-height: 80px;
}

/* Sidebar description and tags inputs */
.key-sidebar-panel textarea,
.key-sidebar-panel input[type="text"] {
    font-size: 0.8125rem;
}

/* Sidebar jobs list */
.key-sidebar-panel .tag {
    margin-left: 4px;
    vertical-align: middle;
}

/* --- Job Detail --- */

.job-tag-display {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    box-shadow: var(--shadow);
}

.job-tag-value {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
}

.job-tag-code {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--sh-navy);
    background: rgba(0, 225, 140, 0.1);
    padding: 6px 16px;
    border-radius: var(--radius);
    letter-spacing: 0.02em;
    user-select: all;
    border: 1px solid rgba(0, 225, 140, 0.3);
}

.job-meta-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}

.job-meta-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 32px;
}

.job-meta-item {
    display: flex;
    gap: 4px;
}

.job-briefing {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    padding: 12px;
    background: var(--sh-cream);
    border-radius: var(--radius);
    white-space: pre-wrap;
    line-height: 1.5;
}

.job-keys-section {
    margin-top: 24px;
}

/* --- Glossary --- */

.glossary-filters select {
    width: auto;
    min-width: 160px;
}

/* --- Dashboard --- */

.dashboard-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.dashboard-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
}

.dashboard-card-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 4px;
    color: var(--sh-navy);
}

.dashboard-card-label {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.locale-progress-cell {
    min-width: 200px;
}

.locale-progress-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.locale-progress-row .progress-bar {
    flex: 1;
}

/* --- History Timeline --- */

.history-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.history-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border-light);
    font-size: 0.8125rem;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item-header {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: baseline;
}

.history-user {
    font-weight: 600;
    color: var(--sh-navy);
}

.history-action {
    color: var(--color-text-secondary);
}

.history-time {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.history-diff {
    margin-top: 4px;
    padding: 4px 8px;
    background: var(--sh-cream);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    line-height: 1.5;
}

.history-diff-label {
    color: var(--color-text-muted);
    font-weight: 500;
}

.history-old {
    color: var(--color-danger);
    text-decoration: line-through;
    opacity: 0.7;
}

.history-new {
    color: var(--color-success);
}

.history-show-more {
    margin-top: 8px;
    text-align: center;
    display: block;
    width: 100%;
}

/* --- Responsive: Editor stacks vertically on narrow screens --- */

@media (max-width: 1024px) {
    .editor-layout {
        grid-template-columns: 240px 1fr;
    }

    .key-sidebar-panel {
        display: none;
    }

    .navbar-nav {
        gap: 2px;
    }

    .nav-link {
        padding: 6px 8px;
        font-size: 0.8125rem;
    }
}

@media (max-width: 899px) {
    .editor-layout {
        grid-template-columns: 1fr;
        height: auto;
        margin: 0;
        overflow: visible;
    }

    .editor-panel {
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        overflow-y: visible;
    }

    .editor-panel:last-child {
        border-bottom: none;
    }

    .key-list-panel {
        max-height: 40vh;
        overflow-y: auto;
    }

    .key-sidebar-panel {
        display: block;
        max-height: none;
    }

    /* Main content no padding override for stacked editor */
    .main-content:has(.editor-layout) {
        padding: 0;
        max-width: none;
    }

    /* Navbar: stack on very small screens */
    .navbar {
        flex-wrap: wrap;
        height: auto;
        padding: 8px 12px;
        gap: 8px;
    }

    .navbar-left {
        flex-wrap: wrap;
        gap: 8px;
    }

    .navbar-nav {
        flex-wrap: wrap;
        gap: 2px;
    }

    .nav-link {
        padding: 4px 8px;
        font-size: 0.8125rem;
    }
}

@media (max-width: 768px) {
    .editor-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .key-list-panel {
        max-height: 40vh;
    }

    .navbar {
        padding: 0 12px;
    }

    .navbar-left {
        gap: 12px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .dashboard-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .conflict-values {
        grid-template-columns: 1fr;
    }

    .conflict-side:first-child {
        border-right: none;
        border-bottom: 1px solid var(--color-border-light);
    }

    .user-name {
        display: none;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }
}

/* --- Responsive: Modal max-width constraint --- */

@media (max-width: 560px) {
    .modal {
        max-width: calc(100vw - 32px);
        margin: 16px;
    }
}

/* Glossary suggestions in editor sidebar */
.glossary-suggestion {
    padding: 4px 0;
    border-bottom: 1px solid var(--color-border-light);
}

.glossary-suggestion:last-child {
    border-bottom: none;
}

/* --- Add Keys Modal --- */

.add-keys-results .form-check {
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border-light);
}

.add-keys-results .form-check:last-child {
    border-bottom: none;
}

/* --- Utility additions --- */

.ml-1 { margin-left: 4px; }

/* --- Locale Actions --- */

.locale-actions-cell {
    white-space: nowrap;
    display: flex;
    gap: 6px;
    align-items: center;
}

.locale-more-wrap {
    position: relative;
}

.locale-more-btn {
    font-size: 1.125rem;
    letter-spacing: 2px;
    padding: 4px 8px;
    min-height: auto;
    line-height: 1;
}

.locale-more-menu {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    min-width: 180px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 50;
    padding: 4px;
}

.locale-more-item {
    display: block;
    width: 100%;
    padding: 8px 12px;
    font-size: 0.8125rem;
    font-family: inherit;
    text-align: left;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 150ms ease;
}

.locale-more-item:hover {
    background: var(--sh-cream);
}

.locale-more-item-danger {
    color: var(--color-danger);
}

.locale-more-item-danger:hover {
    background: rgba(239, 68, 68, 0.08);
}

.btn-danger-outline {
    background: transparent;
    color: var(--color-danger);
    border-color: var(--color-danger);
}

.btn-danger-outline:hover:not(:disabled) {
    background: var(--color-danger-light);
    color: var(--color-danger-hover);
    border-color: var(--color-danger-hover);
}

/* --- Empty Locale Warning --- */

.empty-locale-warning {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: var(--color-danger-light);
    border: 1px solid var(--color-danger);
    border-radius: var(--radius);
}

.empty-locale-warning-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    background: var(--color-danger);
    color: #ffffff;
    border-radius: 50%;
    font-weight: 700;
    font-size: 1.1rem;
}

.empty-locale-warning p {
    margin: 0;
    line-height: 1.6;
    color: var(--color-text);
}

/* --- Job Progress Bar (inline in job list rows) --- */

.job-progress-cell {
    min-width: 160px;
}

.job-progress-bar-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.job-progress-bar-wrap .progress-bar {
    flex: 1;
}

.job-progress-bar {
    height: 6px;
}

.job-name-link {
    color: var(--sh-navy);
    font-weight: 600;
    text-decoration: none;
    transition: color var(--transition);
}

.job-name-link:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

/* Job tag inline in list rows */
.job-tag-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.job-tag-code-sm {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--sh-navy);
    background: var(--color-primary-light);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(0, 225, 140, 0.25);
    user-select: all;
}

.btn-icon-copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    transition: background var(--transition), color var(--transition);
}

.btn-icon-copy:hover {
    background: var(--color-border-light);
    color: var(--sh-navy);
}

/* Job detail tag line */
.job-detail-tag-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

/* Job actions wrap */
.job-actions-wrap {
    display: flex;
    gap: 4px;
}

/* --- Job Locale Progress Table --- */

.job-locale-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}

.job-locale-table {
    width: 100%;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--sh-navy);
}

/* --- Job Filter Banner (in editor key list) --- */

.job-filter-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    margin: 0;
    background: var(--color-primary-light);
    border-bottom: 1px solid rgba(0, 225, 140, 0.3);
    font-size: 0.8125rem;
    color: var(--sh-navy);
}

.job-filter-banner-text {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.job-filter-banner-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    min-width: 22px;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: 50%;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    transition: background var(--transition), color var(--transition);
}

.job-filter-banner-clear:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--sh-navy);
}

/* --- Login page responsive --- */

@media (max-width: 420px) {
    .login-card {
        padding: 28px 20px;
        margin: 0 16px;
    }
}
