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

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    min-height: 100vh;
}

.navbar {
    background: #1a1a2e;
    color: #fff;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.navbar .brand { font-size: 1.1rem; font-weight: 700; letter-spacing: .5px; }
.navbar a { color: #adb5bd; text-decoration: none; font-size: .9rem; }
.navbar a:hover { color: #fff; }

.container {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,.08);
    padding: 2rem;
    margin-bottom: 1.5rem;
}
.card h2 { margin-bottom: 1.2rem; font-size: 1.15rem; color: #1a1a2e; border-bottom: 2px solid #e9ecef; padding-bottom: .6rem; }

/* Login */
.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.login-box {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,.12);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
}
.login-box h1 { text-align: center; font-size: 1.4rem; margin-bottom: 1.8rem; color: #1a1a2e; }

label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .3rem; color: #495057; }

input[type=text], input[type=password], input[type=file] {
    width: 100%;
    padding: .6rem .9rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: .95rem;
    margin-bottom: 1rem;
    transition: border-color .2s;
}
input[type=text]:focus, input[type=password]:focus {
    outline: none;
    border-color: #4361ee;
    box-shadow: 0 0 0 3px rgba(67,97,238,.15);
}

.btn {
    display: inline-block;
    padding: .6rem 1.4rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .2s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: #4361ee; color: #fff; }
.btn-primary:hover { background: #3451d1; }
.btn-success { background: #2dc653; color: #fff; }
.btn-success:hover { background: #25a244; }
.btn-secondary { background: #6c757d; color: #fff; }
.btn-secondary:hover { background: #5a6268; }
.btn-block { width: 100%; text-align: center; }

.alert {
    padding: .75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: .9rem;
}
.alert-danger { background: #fff0f0; border: 1px solid #f5c6cb; color: #842029; }
.alert-success { background: #f0fff4; border: 1px solid #b7dfc8; color: #155724; }
.alert-info { background: #e8f4fd; border: 1px solid #b8daff; color: #0c5460; }

/* Upload area */
.upload-area {
    border: 2px dashed #ced4da;
    border-radius: 8px;
    padding: 2.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    margin-bottom: 1rem;
}
.upload-area:hover, .upload-area.dragover {
    border-color: #4361ee;
    background: #f0f3ff;
}
.upload-area p { color: #6c757d; font-size: .95rem; margin-top: .5rem; }
.upload-icon { font-size: 2.5rem; }

/* Tables panel */
.tables-grid {
    display: grid;
    gap: 1rem;
}
.table-block {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
}
.table-header {
    background: #1a1a2e;
    color: #fff;
    padding: .7rem 1rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    font-weight: 600;
    font-size: .95rem;
}
.table-header label { color: #fff; font-weight: 600; margin: 0; cursor: pointer; display: flex; align-items: center; gap: .5rem; }
.table-header input[type=checkbox] { width: 16px; height: 16px; margin: 0; cursor: pointer; accent-color: #4361ee; }

.fields-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .4rem;
    padding: .8rem 1rem;
    background: #fafbfc;
}
.field-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .5rem;
    border-radius: 4px;
    font-size: .88rem;
    transition: background .15s;
}
.field-item:hover { background: #e9ecef; }
.field-item input[type=checkbox] { width: 15px; height: 15px; margin: 0; accent-color: #4361ee; cursor: pointer; }
.field-item label { margin: 0; cursor: pointer; color: #343a40; font-weight: 400; }
.field-type { color: #6c757d; font-size: .78rem; margin-left: auto; font-family: monospace; }

/* Result table */
.result-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.result-table th { background: #1a1a2e; color: #fff; padding: .5rem .75rem; text-align: left; }
.result-table td { padding: .5rem .75rem; border-bottom: 1px solid #dee2e6; }
.result-table tr:hover td { background: #f8f9fa; }
.badge { padding: .25rem .55rem; border-radius: 20px; font-size: .78rem; font-weight: 600; }
.badge-success { background: #d4edda; color: #155724; }
.badge-danger { background: #f8d7da; color: #721c24; }

.actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.mb-1 { margin-bottom: .5rem; }
.mt-1 { margin-top: .5rem; }
.text-muted { color: #6c757d; font-size: .85rem; }
