* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #3b82f6;
    --primary-dark: #1e40af;
    --secondary: #6b7280;
    --background: #f9fafb;
    --border: #e5e7eb;
    --text: #1f2937;
    --text-muted: #6b7280;
    --success: #10b981;
    --hover-bg: #f3f4f6;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
header {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
    text-decoration: none;
}

/* Cards */
.card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Typography */
h1 {
    font-size: 1.875rem;
    margin-bottom: 0.5rem;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

h3 {
    font-size: 1rem;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

/* Table Styling */
.sheet-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    margin-top: 1rem;
}

.sheet-table thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.sheet-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sheet-table th:first-child {
    width: 60px;
    text-align: center;
}

.sheet-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s ease;
}

.sheet-table tbody tr:hover {
    background-color: var(--hover-bg);
}

.sheet-table tbody tr:last-child {
    border-bottom: none;
}

.sheet-table td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
}

.sheet-table td:first-child {
    background: #f0f4f8;
    text-align: center;
    font-weight: 500;
    color: var(--secondary);
    width: 60px;
}

.sheet-table input {
    width: 100%;
    border: 1px solid transparent;
    outline: none;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 1rem;
    background: white;
    transition: all 0.2s ease;
    font-family: 'Courier New', monospace;
}

.sheet-table input:focus {
    background: #eff6ff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.sheet-table input::-webkit-inner-spin-button,
.sheet-table input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.sheet-table input[type=number] {
    -moz-appearance: textfield;
}

.sheet-table input::placeholder {
    color: #d1d5db;
}

.sheet-table .row-number {
    font-weight: 600;
    color: var(--secondary);
}

.sheet-table .delete-btn {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #dc2626;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
    padding: 0;
}

.sheet-table .delete-btn:hover {
    background: #fca5a5;
    border-color: #f87171;
}

/* Tip Box */
.tip-box {
    margin-top: 1rem;
    padding: 1rem;
    background: #f0fdf4;
    border-left: 4px solid var(--success);
    border-radius: 4px;
    font-size: 0.95rem;
    color: #065f46;
}

/* Buttons */
.btn-group {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: white;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--hover-bg);
    border-color: var(--secondary);
}

/* Results Grid */
.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.result-item {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    text-align: center;
}

.result-item h4 {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.result-item p {
    font-size: 1.75rem;
    font-weight: bold;
    color: var(--primary);
    font-family: 'Courier New', monospace;
}

/* Stats Info */
.stats-info {
    margin-top: 1rem;
    padding: 1rem;
    background: #eff6ff;
    border-left: 4px solid var(--primary);
    border-radius: 4px;
    font-size: 0.9rem;
    color: #1e3a8a;
}

.stats-info strong {
    display: inline-block;
    margin-right: 0.5rem;
}

/* Layout */
.main-wrapper {
    display: flex;
    gap: 2rem;
}

.content-area {
    flex: 1;
}

.sidebar {
    width: 280px;
    flex-shrink: 0;
}

.sidebar-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.sidebar-card h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text);
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.75rem;
}

.sidebar-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-link {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--primary);
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: #eff6ff;
    border-left-color: var(--primary);
    padding-left: 1.25rem;
}

/* Footer */
footer {
    background: white;
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 3rem;
}

footer a {
    color: var(--primary);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .card {
        padding: 1.5rem;
    }
    
    .main-wrapper {
        flex-direction: column;
        gap: 1rem;
    }
    
    .sidebar {
        width: 100%;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn {
        justify-content: center;
    }
    
    .result-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    h1 {
        font-size: 1.5rem;
    }
}