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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    height: 100vh;
    background: #f5f6fa;
    color: #2c3e50;
}

.sidebar {
    width: 240px;
    background: #2c3e50;
    color: #ecf0f1;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    flex-shrink: 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 1px solid #34495e;
    margin-bottom: 10px;
}

.sidebar-section {
    padding: 15px 20px;
    border-top: 1px solid #34495e;
    margin-top: 10px;
}

.sidebar-section label {
    display: block;
    font-size: 0.8rem;
    color: #bdc3c7;
    margin-bottom: 6px;
}

.sidebar-section select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #34495e;
    background: #34495e;
    color: #ecf0f1;
    border-radius: 6px;
    font-size: 0.9rem;
}

nav a {
    display: block;
    padding: 15px 25px;
    color: #bdc3c7;
    text-decoration: none;
    transition: all 0.2s;
}

nav a:hover {
    background: #34495e;
    color: #ecf0f1;
}

nav a.active {
    background: #1abc9c;
    color: #fff;
    font-weight: bold;
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

header {
    background: #fff;
    padding: 15px 30px;
    border-bottom: 1px solid #dfe6e9;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

header h1 {
    font-size: 1.4rem;
    color: #2c3e50;
}

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

.last-update {
    font-size: 0.85rem;
    color: #7f8c8d;
    white-space: nowrap;
}

.btn-refresh {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid #1abc9c;
    background: #fff;
    color: #1abc9c;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-refresh:hover:not(:disabled) {
    background: #1abc9c;
    color: #fff;
}

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

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner.hidden {
    display: none;
}

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

.content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.content p {
    font-size: 1.1rem;
    color: #7f8c8d;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-top: 10px;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 0.9rem;
    color: #2c3e50;
}

tr:hover {
    background: #f8f9fa;
}

/* Buttons */
.btn-primary {
    padding: 10px 18px;
    background: #1abc9c;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.btn-primary:hover:not(:disabled) {
    background: #16a085;
}

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

.btn-danger {
    padding: 10px 18px;
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.btn-danger:hover:not(:disabled) {
    background: #c0392b;
}

.btn-small {
    padding: 6px 12px;
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.btn-small:hover:not(:disabled) {
    background: #2980b9;
}

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

/* Search box */
.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    max-width: 600px;
}

.search-box input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #dfe6e9;
    border-radius: 6px;
    font-size: 0.95rem;
}

.search-box input:focus {
    outline: none;
    border-color: #1abc9c;
}

/* Warning / Error */
.warning {
    padding: 10px 14px;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.error {
    padding: 10px 14px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.hidden {
    display: none !important;
}

/* Dashboard */
.dashboard h2 {
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: #2c3e50;
}

/* Fon page */
.fon-page h2 {
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: #2c3e50;
}

.btn-update-all {
    margin-top: 15px;
}

/* Forms */
.form-group {
    margin-bottom: 18px;
    max-width: 500px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #2c3e50;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #dfe6e9;
    border-radius: 6px;
    font-size: 0.95rem;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #1abc9c;
}

.form-group input[readonly] {
    background: #f8f9fa;
}

/* Autocomplete */
.autocomplete-wrap {
    position: relative;
    max-width: 500px;
}

.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #dfe6e9;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #ecf0f1;
    font-size: 0.9rem;
}

.autocomplete-item:hover {
    background: #f8f9fa;
}

.autocomplete-item .code {
    font-weight: bold;
    color: #2c3e50;
}

.autocomplete-item .name {
    color: #7f8c8d;
    font-size: 0.85rem;
}

/* Portfolio list */
.portfolio-list {
    max-width: 600px;
}

.portfolio-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: #fff;
    border: 1px solid #ecf0f1;
    border-radius: 6px;
    margin-bottom: 10px;
}

.portfolio-item .name {
    font-weight: 600;
    color: #2c3e50;
}

/* Page header selector */
.page-selector {
    margin-bottom: 20px;
    max-width: 300px;
}

.page-selector select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #dfe6e9;
    border-radius: 6px;
    font-size: 0.95rem;
}

/* Positive / Negative colors */
.positive {
    color: #27ae60;
    font-weight: 600;
}

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