@charset "utf-8";
:root {
    --tear-red: #c1121f;
    --tear-red-dark: #8a0f1b;
    --tear-black: #0f1115;
    --tear-grey: #e5e7eb;
    --tear-muted: #9ca3af;
    --card-bg: rgba(255, 255, 255, 0.92);
    --card-dark: rgba(20, 24, 30, 0.88);
    --shadow: 0 18px 55px rgba(0, 0, 0, 0.35);
    --radius: 16px;
    --radius-lg: 22px;
    --transition: all .18s ease;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    color: #0f172a;
    background-color: #0c0e13;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: #0c0e13 url("../tear_textil_saas_background.png") center center / cover no-repeat fixed;
    opacity: 0.95;
    z-index: -2;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, rgba(6, 7, 10, 0.45), rgba(12, 14, 19, 0.55));
    z-index: -1;
}

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 14px;
    position: relative;
}

.login-shell::before {
    content: "";
    position: absolute;
    width: 540px;
    height: 540px;
    background: radial-gradient(circle at 50% 35%, rgba(255,255,255,0.3), rgba(255,255,255,0));
    filter: blur(2px);
    z-index: -1;
}

.login-card {
    width: 100%;
    max-width: 480px;
    background: rgba(248, 250, 252, 0.9);
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.35);
    padding: 24px 24px 22px;
    backdrop-filter: blur(6px);
    text-align: center;
}

.login-logo img {
    max-width: 170px;
    height: auto;
    margin: 0 auto 10px;
    display: block;
}

.login-title {
    margin: 10px 0 4px;
    font-size: 22px;
    font-weight: 800;
    color: #111827;
}

.login-subtitle {
    margin: 0 0 18px;
    color: #6b7280;
    font-size: 14px;
}

.login-card form {
    text-align: left;
}

.input-eye {
    position: relative;
}

.input-eye .icon-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    height: 32px;
    width: 32px;
    padding: 6px;
    border: none;
}

.login-btn {
    width: 100%;
    margin-top: 10px;
    font-size: 16px;
}

.login-note {
    margin-top: 10px;
    text-align: center;
    color: #6b7280;
    font-size: 12px;
}

.login-footer {
    text-align: center;
    color: #9ca3af;
    font-size: 12px;
    margin-top: 12px;
}

.page-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 28px 14px 48px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 18px;
    background: rgba(255,255,255,0.92);
    border: 1px solid rgba(15,23,42,0.06);
    border-radius: var(--radius);
    box-shadow: 0 12px 30px rgba(0,0,0,0.18);
    color: #0f172a;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo {
    width: auto;
    height: 78px;
    background: transparent;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: none;
}

.brand-logo img {
    max-height: 100%;
    width: auto;
    object-fit: contain;
}

.brand img {
    height: 42px;
    width: auto;
}

.brand h1 {
    margin: 0;
    font-size: 20px;
    letter-spacing: 0.02em;
    color: #0f172a;
    font-family: "Segoe UI Semibold", "Segoe UI", "Helvetica Neue", sans-serif;
}

.brand small {
    display: block;
    font-size: 11px;
    color: #c1121f;
}

.actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 18px 18px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(8px);
    min-height: 260px;
    height: auto;
    align-self: stretch;
    display: flex;
    flex-direction: column;
}

.card.dark {
    background: var(--card-dark);
    color: #f3f4f6;
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 16px 40px rgba(0,0,0,0.35);
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: stretch;
    grid-auto-rows: 1fr;
}

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

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.grid-5 {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
}
.grid-6 {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
}

.inline-pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.grid-span-2 { grid-column: span 2; }
.nf-input {
    width: 100%;
    max-width: none;
}

.nf-row {
    display: flex;
    gap: 14px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.nf-field {
    display: flex;
    flex-direction: column;
    flex: 0 0 calc((100% - 4 * 14px) / 5);
    max-width: calc((100% - 4 * 14px) / 5);
}

.nf-actions {
    display: flex;
    align-items: flex-end;
    flex: 0 0 auto;
}

.grid-1 {
    display: grid;
    gap: 12px;
}

.field { margin-bottom: 12px; }
.field-msg {
    font-size: 12px;
    color: #dc2626;
    margin-top: 4px;
}
.char-counter {
    font-size: 12px;
    color: #6b7280;
    text-align: right;
    margin-top: 4px;
}
.spell-hint {
    font-size: 12px;
    color: #b91c1c;
    margin-top: 2px;
}
.cost-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.cost-row label {
    margin: 0;
    font-size: 13px;
}
.cost-row .input {
    width: auto;
    min-width: 180px;
    max-width: 240px;
}
.selection-box {
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 14px;
    padding: 14px 16px;
    background: #f8fafc;
}
.selection-title {
    margin: 0 0 10px;
    font-weight: 800;
    letter-spacing: 0.01em;
    color: #0f172a;
}
.selection-options {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.selection-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-weight: 700;
    transition: var(--transition);
}
.selection-option:hover {
    border-color: rgba(193, 18, 31, 0.38);
    box-shadow: 0 10px 24px rgba(193, 18, 31, 0.12);
}
.selection-option input {
    margin: 0;
    accent-color: var(--tear-red);
}

@media (max-width: 960px) {
    .grid-2, .grid-3, .grid-4, .grid-5, .grid-6 {
        grid-template-columns: 1fr;
    }
    .inline-pair {
        grid-template-columns: 1fr;
    }
    .grid-span-2 { grid-column: span 1; }
    .nf-input { max-width: 100%; }
    .nf-row {
        flex-direction: column;
        align-items: stretch;
    }
    .nf-actions {
        width: 100%;
    }
    #btnValidar {
        width: 100%;
        justify-content: center;
    }
    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }
    .card {
        padding: 16px 16px;
    }
}

label {
    display: block;
    font-size: 12px;
    color: #0f172a;
    font-weight: 600;
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

.dark label { color: #e5e7eb; }

.input, select, textarea {
    width: 100%;
    padding: 10px 11px;
    border-radius: 12px;
    border: 1px solid #d1d5db;
    font-size: 14px;
    outline: none;
    background: #fff;
    transition: var(--transition);
}

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

.input:focus, select:focus, textarea:focus {
    border-color: var(--tear-red);
    box-shadow: 0 0 0 3px rgba(193, 18, 31, 0.15);
}

.input:hover {
    border-color: rgba(193, 18, 31, 0.35);
}

.input.error {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220,38,38,0.2);
}

.input[readonly], select[disabled] {
    background: #f3f4f6;
    color: #4b5563;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 12px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    position: relative;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--tear-red), #e11d48);
    color: #fff;
    box-shadow: 0 10px 28px rgba(225, 29, 72, 0.35);
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn-primary:active { transform: translateY(0); }

.btn.loading {
    opacity: 0.9;
    pointer-events: none;
}

.btn.loading::after {
    content: "";
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    border-top-color: transparent;
    animation: spin 0.9s linear infinite;
}

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

.btn-secondary {
    background: #0f172a;
    color: #e5e7eb;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.btn-ghost {
    background: transparent;
    color: #0f172a;
    border: 1px solid rgba(15,23,42,0.12);
    text-decoration: none;
}

.icon-btn {
    min-width: 30px;
    justify-content: center;
    padding: 6px;
}

.icon-eye svg {
    width: 18px;
    height: 18px;
}

.btn-danger {
    background: #b91c1c;
    color: #fff;
}

.status {
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 13px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.status.success { background: #ecfdf3; color: #166534; border: 1px solid #bbf7d0; }
.status.error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.status.info    { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

.tab-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.tab {
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255,255,255,0.8);
    border: 1px solid #e5e7eb;
    cursor: pointer;
    font-weight: 700;
    color: #0f172a;
    transition: var(--transition);
}

.tab.active {
    background: linear-gradient(135deg, rgba(193,18,31,0.15), rgba(193,18,31,0.3));
    border-color: rgba(193,18,31,0.45);
    color: #7f1d1d;
    box-shadow: 0 12px 30px rgba(193,18,31,0.15);
}

.tab.disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.panel-title {
    margin: 0 0 10px;
    font-size: 16px;
    color: #111827;
}

.table-panel {
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    display: flex;
    flex-direction: column;
    min-height: 260px;
}

.table-panel header {
    padding: 10px 12px;
    background: linear-gradient(90deg, rgba(193,18,31,0.1), rgba(193,18,31,0.05));
    font-weight: 700;
    color: #7f1d1d;
    position: sticky;
    top: 0;
    z-index: 2;
}

.table-panel.compact header {
    padding: 6px 10px;
    font-size: 12.5px;
}

.table-scroll {
    overflow: auto;
    max-height: 320px;
}

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

th, td {
    padding: 8px 10px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    font-size: 13px;
    color: #0f172a;
}

th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    z-index: 1;
}

tr:hover { background: #f1f5f9; }
tr.selected { background: rgba(193,18,31,0.1); }

.table-panel.compact th,
.table-panel.compact td {
    padding: 5px 6px;
    font-size: 10px;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.table-panel.compact th,
.table-panel.compact td {
    text-align: right;
}

.nf-table th:nth-child(-n+4),
.nf-table td:nth-child(-n+4) {
    text-align: center;
}

.panel-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    justify-content: center;
    padding: 10px 6px;
    height: 100%;
    box-sizing: border-box;
}

.panel-actions button {
    width: 46px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: #f8fafc;
    cursor: pointer;
    font-weight: 800;
    color: #0f172a;
    transition: var(--transition);
}

.panel-actions button:hover { background: rgba(193,18,31,0.12); }
.panel-actions.compact { gap: 8px; }
.panel-actions.compact button {
    width: 52px;
    height: 34px;
    font-size: 13px;
}
.items-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.item-desc {
    border: 1px dashed rgba(15, 23, 42, 0.18);
    border-radius: 12px;
    padding: 10px 12px;
    background: #f8fafc;
    font-size: 12px;
    color: #1f2937;
    min-height: 60px;
}
.item-desc strong {
    display: block;
    margin-bottom: 6px;
    color: #0f172a;
}
.item-desc.loading {
    font-style: italic;
    color: #4b5563;
}
.item-desc.error {
    border-color: #fca5a5;
    background: #fef2f2;
    color: #991b1b;
}

.items-grid {
    display: grid;
    grid-template-columns: 1fr 80px 1fr;
    gap: 10px;
    align-items: start;
}

@media (max-width: 1200px) {
    .items-grid {
        grid-template-columns: 1fr;
    }
.panel-actions.compact {
    flex-direction: row;
    justify-content: center;
    gap: 8px;
}
.panel-actions.compact button {
        width: 44px;
}
}

.defeito-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 11px;
    background: transparent;
    text-align: right;
}

.defeito-input::placeholder {
    color: #9ca3af;
}

.pill {
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(193,18,31,0.12);
    color: #7f1d1d;
    font-size: 12px;
    font-weight: 700;
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

#btnValidar {
    min-width: 160px;
    padding: 12px 20px;
    font-size: 15px;
}

.muted { color: #6b7280; font-size: 12px; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 22px; }
.mb-0 { margin-bottom: 0; }
.w-100 { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99;
}

.modal {
    background: #fff;
    padding: 18px 20px;
    border-radius: 14px;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow);
}

.modal .actions {
    justify-content: flex-end;
}

.placeholder {
    padding: 18px;
    border: 1px dashed rgba(255,255,255,0.3);
    border-radius: 12px;
    color: #e5e7eb;
    background: rgba(255,255,255,0.06);
}

.hidden { display: none !important; }

.attachment-box {
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 14px;
    padding: 12px;
    background: #fff;
    margin-top: 6px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.attachment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.attachment-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.attachment-list {
    display: grid;
    gap: 10px;
}

.attachment-list.empty {
    border: 1px dashed rgba(15, 23, 42, 0.2);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    background: #f8fafc;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    padding: 10px;
    background: #f8fafc;
}

.attachment-thumb {
    width: 54px;
    height: 54px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.attachment-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.attachment-meta {
    flex: 1;
    min-width: 0;
}

.attachment-meta .name {
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
    word-break: break-all;
}

.attachment-meta .details {
    font-size: 12px;
    color: #6b7280;
}

.attachment-remove {
    border: none;
    background: #fff5f5;
    color: #b91c1c;
    border: 1px solid #fecdd3;
    border-radius: 10px;
    padding: 8px 10px;
    cursor: pointer;
    font-weight: 700;
    transition: var(--transition);
}

.attachment-remove:hover {
    background: #fee2e2;
}
