:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #64748b;
    --bg: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #ef4444;
    --excel: #107c41;
    --table-head-bg: #f1f5f9;
    --table-row-even: #f8fafc;
    --table-hover: #e2e8f0;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 20px;
    font-size: 14px;
    padding-bottom: 80px;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

input, select, textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.container { max-width: 1100px; margin: 0 auto; }

.header-card {
    background: var(--surface); padding: 24px; border-radius: 16px;
    border: 1px solid var(--border); margin-bottom: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    display: flex; flex-direction: column; gap: 20px;
}
.header-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; }

.header-title h1 {
    margin: 0; color: var(--text); font-size: 1.5rem;
    display: flex; align-items: center; gap: 10px; letter-spacing: -0.5px;
}
.header-title h1 i { color: var(--primary); }

.candidate-input-group { display: flex; gap: 10px; }
.name-input {
    padding: 10px 15px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 14px; width: 220px; transition: all 0.2s;
}
.name-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

.score-dashboard {
    background: #f8fafc; border: 1px solid var(--border); border-radius: 12px;
    padding: 20px; display: grid; grid-template-columns: 1.2fr 2fr; gap: 20px; align-items: center;
}
.score-display { display: flex; flex-direction: column; }
.score-value { font-size: 2.5rem; font-weight: 800; color: var(--primary); line-height: 1; letter-spacing: -1px; }
.score-label { font-size: 0.8rem; color: var(--secondary); font-weight: 600; margin-top: 5px; text-transform: uppercase; }

.progress-area { width: 100%; }
.progress-header { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.9rem; font-weight: 600; }
.progress-track { width: 100%; height: 12px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--primary); transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s; }

.status-orange .progress-fill { background: var(--warning); }
.status-orange .status-text { color: #d97706; }
.status-green .progress-fill { background: var(--success); }
.status-green .status-text { color: var(--success); }
.status-green .score-value { color: var(--success); }

.guide-card {
    border-radius: 12px;
    border: 1px dashed #cbd5e1;
    background: #f9fafb;
    padding: 12px 16px;
    display: flex;
    gap: 10px;
    font-size: 0.8rem;
    color: #475569;
}
.guide-icon {
    width: 28px; height: 28px; border-radius: 999px;
    background: #eff6ff; display: flex; align-items: center;
    justify-content: center; color: var(--primary);
}
.guide-content strong { font-size: 0.8rem; }
.guide-list { margin: 4px 0 0 0; padding-left: 18px; }
.guide-list li { margin-bottom: 2px; }

.input-card {
    background: var(--surface); border-radius: 16px; border: 1px solid var(--border);
    margin-bottom: 24px; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}
.card-header-bar {
    background: #f8fafc; padding: 15px 24px; border-bottom: 1px solid var(--border);
    font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 10px;
}
.card-header-bar i { color: var(--primary); }
.card-body { padding: 24px; }

select, input[type="number"], input[type="text"] {
    width: 100%; padding: 10px 12px; font-family: 'Inter', sans-serif;
    font-size: 14px; color: var(--text); background-color: #fff;
    border: 1px solid #cbd5e1; border-radius: 8px;
    appearance: none; -webkit-appearance: none; transition: border 0.2s;
}
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 1rem center; background-size: 1.2em; padding-right: 2.5rem; cursor: pointer;
}
select:focus, input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.75rem; font-weight: 700; color: var(--secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.grid-row { display: grid; grid-template-columns: 1fr; gap: 20px; }

@media (min-width: 768px) {
    .grid-row { grid-template-columns: repeat(12, 1fr); }
    .col-12 { grid-column: span 12; } .col-8 { grid-column: span 8; }
    .col-6 { grid-column: span 6; } .col-4 { grid-column: span 4; } .col-2 { grid-column: span 2; }
}

.card-footer {
    padding: 15px 24px; background: #f8fafc; border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 10px;
}

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 0 24px; height: 42px; border-radius: 8px; font-weight: 600; font-size: 14px;
    border: none; cursor: pointer; transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: white; box-shadow: 0 2px 4px rgba(37,99,235,0.3); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-primary:disabled { background: #94a3b8; cursor: not-allowed; box-shadow: none; transform: none; }
.btn-danger-soft { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; padding: 0 15px; }
.btn-danger-soft:hover { background: #fee2e2; }

.btn-excel {
    background: var(--excel); color: white; width: 100%; margin-top: 20px; height: 50px; font-size: 15px;
    border-radius: 12px; box-shadow: 0 4px 6px rgba(16, 124, 65, 0.2);
}
.btn-excel:hover { background: #0c6132; transform: translateY(-1px); }

.table-container {
    background: var(--surface); border-radius: 16px; border: 1px solid var(--border);
    overflow: hidden; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}
table { width: 100%; border-collapse: collapse; min-width: 800px; }
thead th {
    background: var(--table-head-bg); color: var(--secondary); font-weight: 700;
    text-align: center; padding: 14px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
}
thead th:first-child { text-align: left; padding-left: 24px; }
tbody td {
    padding: 14px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text);
    transition: background-color 0.2s;
}
tbody td:first-child { padding-left: 24px; }
tbody tr:nth-child(even) { background-color: var(--table-row-even); }
tbody tr:hover { background-color: var(--table-hover); cursor: default; }

.row-ok { border-left: 4px solid var(--success); }
.row-miss { border-left: 4px solid var(--warning); }
.row-def { border-left: 4px solid transparent; }

.score-cell {
    font-family: 'Inter', sans-serif; font-variant-numeric: tabular-nums;
    font-weight: 600; font-size: 0.95rem; color: #334155; text-align: center;
}
.final-score {
    color: var(--primary); font-weight: 800; background-color: rgba(37, 99, 235, 0.05); border-radius: 6px;
}

.action-btn {
    width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--border);
    background: white; color: var(--secondary); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.action-btn:hover { background: #f1f5f9; color: var(--text); border-color: #cbd5e1; }
.btn-del:hover { background: #fef2f2; color: var(--danger); border-color: #fca5a5; }

tfoot { background: #f8fafc; border-top: 2px solid var(--border); }
tfoot td { font-weight: 700; padding: 16px; font-size: 1rem; color: var(--text); }
tfoot .score-cell { font-size: 1.1rem; color: var(--text); }
tfoot #t-net { color: var(--primary); font-weight: 800; }

@media (max-width: 768px) {
    .score-dashboard { grid-template-columns: 1fr; text-align: center; }
    .header-top { flex-direction: column; align-items: stretch; }
    .name-input { width: 100%; }
    .col-8, .col-6, .col-4, .col-2 { grid-column: span 12; }
    .table-container { overflow-x: auto; }
    .card-footer { flex-direction: column; }
    .btn { width: 100%; }
}

.detail-row { background: #f1f5f9 !important; }
.detail-wrapper { padding: 10px 24px 24px 24px; }
.sub-table { width: 100%; font-size: 0.85rem; background: white; border-radius: 8px; border: 1px solid var(--border); box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.sub-table th { background: #f8fafc; padding: 12px; text-transform: none; border-bottom: 1px solid var(--border); color: var(--secondary); text-align: left; }
.sub-table td { padding: 12px; border-bottom: 1px solid #f1f5f9; text-align: left; }
.sub-table th:nth-last-child(1), .sub-table td:nth-last-child(1) { text-align: center; }
.sub-table th:nth-last-child(2), .sub-table td:nth-last-child(2) { text-align: center; }

.criteria-panel {
    margin-top: 16px; padding: 16px 20px; border-radius: 12px;
    border: 1px dashed #cbd5e1; background: #f9fafb;
    font-size: 0.85rem; color: #475569;
}
.criteria-title {
    font-weight: 700; font-size: 0.78rem; letter-spacing: 0.08em;
    text-transform: uppercase; color: #64748b; margin-bottom: 6px;
}
.criteria-list {
    display: flex; flex-wrap: wrap; gap: 6px 14px;
    margin: 6px 0 0 0; padding: 0; list-style: none;
}
.criteria-item {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 8px; border-radius: 999px;
    background: white; border: 1px solid #e2e8f0;
}
.criteria-item i { font-size: 0.75rem; }
.criteria-ok i { color: var(--success); }
.criteria-miss i { color: var(--warning); }

.badge-mandatory {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em;
    background: #fef2f2; color: #b91c1c;
    padding: 2px 7px; border-radius: 999px; margin-left: 6px; cursor: help;
}

.input-card.highlighted {
    box-shadow: 0 0 0 2px rgba(37,99,235,0.4);
    transition: box-shadow 0.4s ease;
}
