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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f4f8;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1100px;
    width: 100%;
    background: white;
    padding: 30px;
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

h1 {
    font-size: 26px;
    font-weight: 600;
    color: #1a2634;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.subhead {
    color: #4a5b6e;
    font-size: 15px;
    border-left: 4px solid #3b82f6;
    padding-left: 14px;
    margin: 6px 0 24px 0;
    background: #f0f4ff;
    border-radius: 0 12px 12px 0;
    line-height: 1.5;
    padding: 10px;
}

.control-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
    background: #f8fafc;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
}

.control-bar label {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
}

.control-bar input {
    padding: 8px 12px;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    font-size: 14px;
    font-weight: 600;
    width: 80px;
    margin: 0 6px;
    text-align: center;
}

.control-bar input:focus {
    outline: none;
    border-color: #3b82f6;
}

.btn-primary {
    padding: 10px 20px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    background: #1e2a3a;
    color: white;
    transition: 0.15s;
}

.btn-primary:hover {
    background: #2d3f55;
    transform: scale(1.02);
}

.table-responsive {
    overflow-x: auto;
    margin-bottom: 24px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: white;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 750px;
}

th, td {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    text-align: center;
    vertical-align: middle;
}

th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:last-child td {
    border-bottom: none;
}

.form-input {
    padding: 8px 12px;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    font-size: 14px;
    width: 100%;
    transition: 0.15s;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
}

.form-select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    font-size: 14px;
    background: white;
    width: 100%;
    font-weight: 600;
}

.form-select:focus {
    outline: none;
    border-color: #3b82f6;
}

.val-r {
    color: #ef4444;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 16px;
}

.val-s {
    color: #f59e0b;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 16px;
}

.val-t {
    color: #3b82f6;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 16px;
}

.btn-danger {
    padding: 6px 12px;
    border: none;
    border-radius: 8px;
    background: #fca5a5;
    color: #7f1d1d;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: 0.15s;
}

.btn-danger:hover {
    background: #f87171;
    color: white;
}

.summary-box {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.phase-card {
    padding: 20px;
    border-radius: 18px;
    text-align: center;
    color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.phase-card.r {
    background: #ef4444;
}

.phase-card.s {
    background: #f59e0b;
}

.phase-card.t {
    background: #3b82f6;
}

.phase-card h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    opacity: 0.9;
}

.phase-card .power {
    font-size: 24px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    margin-bottom: 4px;
}

.phase-card .amps {
    font-size: 16px;
    font-weight: 600;
    opacity: 0.95;
}

.total-summary {
    background: #0b1e2f;
    border-radius: 18px;
    padding: 24px;
    text-align: center;
    color: white;
}

.total-summary h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.total-summary .value {
    font-size: 32px;
    font-weight: 700;
    color: #6ee7b7;
    font-family: 'Courier New', monospace;
}

.total-summary .msg {
    margin-top: 10px;
    font-size: 15px;
    font-weight: 700;
}

@media (max-width: 768px) {
    .summary-box {
        grid-template-columns: 1fr;
    }
    .control-bar {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
}
