* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: min(1680px, calc(100vw - 40px));
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 30px;
}

h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 2em;
}

.subtitle {
    color: #666;
    margin-bottom: 30px;
    font-size: 0.95em;
}

.header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.header-content {
    flex: 1;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.search-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
}

.search-button {
    padding: 12px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
    font-weight: 500;
}

.search-button:hover {
    background: #5568d3;
}

.clear-button {
    padding: 12px 24px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
    text-decoration: none;
    display: inline-block;
}

.clear-button:hover {
    background: #5a6268;
}

.results-info {
    margin-bottom: 20px;
    color: #666;
    font-size: 0.95em;
}

.buildings-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    margin-top: 20px;
}

.buildings-table th {
    background: #667eea;
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 600;
}

.buildings-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

.buildings-table tr:hover {
    background: #f8f9fa;
}

.building-id {
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #667eea;
    word-break: break-all;
}

.xml-link {
    color: #28a745;
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.xml-link:hover {
    text-decoration: underline;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: #666;
}

.no-results-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

.entity-badge {
    display: inline-block;
    padding: 4px 8px;
    background: #e9ecef;
    border-radius: 4px;
    font-size: 0.85em;
    color: #495057;
}

.run-api-button {
    padding: 10px 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
}

.run-api-button:hover {
    background: #218838;
}

.run-api-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.dashboard-link {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 500;
    transition: background 0.3s;
}

.dashboard-link:hover {
    background: #5568d3;
}

.api-status {
    display: none;
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 6px;
    font-size: 0.9em;
}

.api-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.api-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.api-status.loading {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.missing-file {
    color: #dc3545;
}

.section-title {
    color: #333;
    font-size: 1.35em;
    margin-bottom: 8px;
}

.section-hint {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 20px;
    line-height: 1.45;
}

.section-hint code {
    font-size: 0.92em;
    background: #f1f3f5;
    padding: 2px 6px;
    border-radius: 4px;
}

.companies-section {
    background: #f8f9fa;
    padding: 22px;
    border-radius: 8px;
    margin-bottom: 28px;
    border: 1px solid #e9ecef;
}

.companies-layout {
    display: grid;
    grid-template-columns: minmax(280px, 380px) 1fr;
    gap: 28px;
    align-items: start;
}

@media (max-width: 900px) {
    .companies-layout {
        grid-template-columns: 1fr;
    }
}

.add-company-form {
    background: white;
    padding: 18px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-subheading {
    font-size: 1.05em;
    color: #444;
    margin-bottom: 4px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.9em;
    color: #495057;
}

.form-field input {
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
}

.form-field input:focus {
    outline: none;
    border-color: #667eea;
}

.add-company-submit {
    margin-top: 6px;
    padding: 11px 16px;
    background: #17a2b8;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.add-company-submit:hover {
    background: #138496;
}

.companies-table-wrap {
    min-width: 0;
}

.companies-table {
    margin-top: 12px;
}

.secret-masked {
    font-family: 'Courier New', monospace;
    font-size: 0.88em;
    color: #6c757d;
}

.form-banner {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 6px;
    font-size: 0.95em;
}

.form-banner--success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.form-banner--error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.pigello-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.pigello-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.pigello-nav-btn {
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: background 0.2s, opacity 0.2s;
    border: none;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.2;
    box-sizing: border-box;
}

.pigello-nav-btn--primary {
    background: #667eea;
    color: white;
}

.pigello-nav-btn--primary:hover {
    background: #5568d3;
    color: white;
}

.pigello-nav-btn--success {
    background: #28a745;
    color: white;
}

.pigello-nav-btn--success:hover:not(:disabled) {
    background: #218838;
    color: white;
}

.pigello-nav-btn--success:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.9;
}

.pigello-nav-btn--teal {
    background: #17a2b8;
    color: white;
}

.pigello-nav-btn--teal:hover {
    background: #138496;
    color: white;
}

.pigello-nav-btn--purple {
    background: #6f42c1;
    color: white;
}

.pigello-nav-btn--purple:hover {
    background: #5a32a3;
    color: white;
}

.pigello-nav-btn--muted {
    background: #6c757d;
    color: white;
}

.pigello-nav-btn--muted:hover {
    background: #5a6268;
    color: white;
}

.pigello-nav-btn--small {
    padding: 6px 12px;
    font-size: 0.85em;
}

.form-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 8px;
}

.building-addresses-cell {
    vertical-align: top;
    width: 38%;
    word-wrap: break-word;
    line-height: 1.4;
}

.buildings-table th:nth-child(2),
.buildings-table td:nth-child(2) {
    width: 14%;
}

.buildings-table th:nth-child(3),
.buildings-table td:nth-child(3) {
    width: 22%;
}

.buildings-table th:nth-child(4),
.buildings-table td:nth-child(4) {
    width: 14%;
}

.buildings-table th:nth-child(5),
.buildings-table td:nth-child(5) {
    width: 12%;
}