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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #e9ecef;
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

.container {
    width: 100%;
    margin: 0;
    background: white;
    box-shadow: none;
    overflow: hidden;
}

header {
    background: #495057;
    color: white;
    padding: 20px;
    text-align: center;
}

header h1 {
    font-size: 1.8em;
    font-weight: 600;
}

.tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

.tab-button {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    color: #6c757d;
}

.tab-button:hover {
    background: #e9ecef;
}

.tab-button.active {
    background: white;
    color: #495057;
    border-bottom: 2px solid #495057;
}

.toolbar {
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

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

.consumption-input label {
    font-weight: 600;
    color: #495057;
    font-size: 0.9em;
}

.consumption-input input {
    padding: 6px 10px;
    border: 1px solid #dee2e6;
    border-radius: 0;
    font-size: 0.9em;
    width: 100px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 0;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #495057;
    color: white;
}

.btn-primary:hover {
    background: #5a6268;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
    padding: 6px 12px;
    font-size: 0.9em;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-edit {
    background: #6c757d;
    color: white;
    padding: 5px 10px;
    font-size: 0.85em;
    margin-right: 5px;
}

.btn-edit:hover {
    background: #5a6268;
}

.btn-small {
    padding: 5px 10px;
    font-size: 0.85em;
}

.filter-bar {
    padding: 10px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
    font-size: 0.85em;
}

.filter-group select {
    padding: 5px 8px;
    border: 1px solid #dee2e6;
    border-radius: 0;
    font-size: 0.85em;
    min-width: 100px;
}

.filter-group select:focus {
    outline: none;
    border-color: #495057;
}

.form-container {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.form-container h2 {
    margin-bottom: 15px;
    color: #495057;
    font-size: 1.2em;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #495057;
    font-size: 0.9em;
}

.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #dee2e6;
    border-radius: 0;
    font-size: 0.9em;
}

.form-group input:focus {
    outline: none;
    border-color: #495057;
}

.form-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #dee2e6;
    border-radius: 0;
    font-size: 0.9em;
    font-family: inherit;
    resize: vertical;
}

.form-group textarea:focus {
    outline: none;
    border-color: #495057;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

.table-container {
    padding: 15px;
    overflow-x: auto;
}

.sort-info {
    margin-bottom: 10px;
    color: #6c757d;
    font-size: 0.8em;
    font-style: italic;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.85em;
}

thead {
    background: #6c757d;
    color: white;
}

th {
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    white-space: normal;
    font-size: 0.85em;
    line-height: 1.3;
}

th small {
    font-weight: 400;
    font-size: 0.85em;
    display: block;
    margin-top: 2px;
    opacity: 0.9;
}

th:hover {
    background: rgba(255, 255, 255, 0.1);
}

td {
    padding: 8px 8px;
    border-bottom: 1px solid #e9ecef;
}

tbody tr {
    transition: all 0.2s;
}

tbody tr:hover {
    background: #f8f9fa;
}

tbody tr.best-tariff {
    background: #d4edda;
    font-weight: 600;
}

tbody tr.best-tariff:hover {
    background: #c3e6cb;
}

.positive {
    color: #28a745;
    font-weight: 600;
}

.negative {
    color: #dc3545;
    font-weight: 600;
}

.no-data {
    padding: 40px 20px;
    text-align: center;
    color: #6c757d;
    font-size: 0.95em;
}

.badge {
    display: inline-block;
    padding: 3px 6px;
    border-radius: 0;
    font-size: 0.75em;
    font-weight: 600;
    margin-left: 6px;
}

.badge-best {
    background: #495057;
    color: white;
}

.cost-bar-container {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
}

.cost-bar {
    height: 16px;
    border-radius: 0;
    transition: width 0.3s ease, background 0.3s ease;
    min-width: 2px;
}

.cost-value {
    font-weight: 600;
    white-space: nowrap;
    font-size: 0.9em;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    table {
        font-size: 0.75em;
    }

    th, td {
        padding: 6px 4px;
    }

    .cost-bar-container {
        min-width: 120px;
    }
}
