/* Base */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    color: #333;
    background: #f5f5f5;
    line-height: 1.5;
}

/* Nav */
nav {
    background: #2c3e50;
    color: white;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    height: 48px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-brand {
    font-weight: 700;
    font-size: 16px;
    white-space: nowrap;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}
.nav-links a {
    color: #ecf0f1;
    text-decoration: none;
    padding: 0.4rem 0.75rem;
    border-radius: 4px;
    font-size: 13px;
}
.nav-links a:hover { background: rgba(255,255,255,0.1); }
.nav-links a.active { background: rgba(255,255,255,0.2); font-weight: 600; }
.nav-user { color: #95a5a6; margin-left: auto; font-size: 13px; }
.nav-logout { color: #e74c3c !important; }

/* Main */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Flash messages */
.flash {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    border-left: 4px solid;
}
.flash-success { background: #d4edda; border-color: #28a745; color: #155724; }
.flash-error { background: #f8d7da; border-color: #dc3545; color: #721c24; }

/* Headings */
h1 { font-size: 1.5rem; margin-bottom: 1rem; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 0.75rem; }

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.page-header h1 { margin-bottom: 0; }
.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-left: auto;
}

/* Tables */
.table-wrapper { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
th, td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}
th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: #666;
}
tbody tr:hover { background: #f8f9fa; }
.row-complete { background: #f0fff0; }
.row-received { background: #fffbf0; }
.total-row { font-weight: 700; background: #f8f9fa; }
.file-cell { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.email-cell { max-width: 200px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }

.table-summary {
    background: white;
    padding: 0.5rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    font-size: 13px;
    color: #666;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Buttons */
.btn, button[type="submit"] {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}
.btn:hover, button[type="submit"]:hover { background: #2980b9; }
.btn-secondary { background: #95a5a6; }
.btn-secondary:hover { background: #7f8c8d; }
.btn-danger { background: #e74c3c; }
.btn-danger:hover { background: #c0392b; }
.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 12px;
    background: #95a5a6;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    text-decoration: none;
}
.btn-small:hover { background: #7f8c8d; }

/* Forms */
label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.25rem;
    margin-top: 0.75rem;
    font-size: 13px;
}
input[type="text"], input[type="password"], input[type="number"], input[type="email"],
input[type="month"], select, textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52,152,219,0.2);
}
input[type="checkbox"] { width: auto; cursor: pointer; }
.form-narrow { max-width: 500px; }
.form-wide { max-width: 900px; }
.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.form-group { flex: 1; min-width: 150px; }
.form-actions { margin-top: 1.5rem; display: flex; gap: 0.5rem; }
.inline-form { display: inline-flex; align-items: center; gap: 0.5rem; }
.delete-form { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid #eee; }

/* Cards */
.card {
    background: white;
    border-radius: 6px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.card-link {
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s;
}
.card-link:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.15); }

/* Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.stat-grid {
    display: flex;
    gap: 2rem;
    margin: 1rem 0;
}
.stat { text-align: center; }
.stat-value { display: block; font-size: 1.5rem; font-weight: 700; color: #2c3e50; }
.stat-label { font-size: 12px; color: #999; text-transform: uppercase; }
.compare { font-size: 13px; color: #666; }
.positive { color: #27ae60; font-weight: 600; }
.negative { color: #e74c3c; font-weight: 600; }

.pending-list { list-style: none; }
.pending-list li { padding: 0.4rem 0; border-bottom: 1px solid #f0f0f0; }
.badge {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    font-size: 11px;
    border-radius: 3px;
    background: #ecf0f1;
    color: #666;
    margin-left: 0.3rem;
}
.badge-warn { background: #ffeaa7; color: #856404; }

/* Reports */
.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

/* Detail */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 2rem;
    background: white;
    padding: 1rem;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}
.full-width { grid-column: 1 / -1; }

/* Increase section */
.increase-section {
    margin-bottom: 1rem;
    background: white;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.increase-section summary { cursor: pointer; font-weight: 500; }

/* Login */
.login-container {
    max-width: 360px;
    margin: 100px auto;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    text-align: center;
}
.login-container h1 { margin-bottom: 1.5rem; color: #2c3e50; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Inline editing */
.inline-input {
    border: 1px solid transparent;
    background: transparent;
    padding: 2px 4px;
    font-size: 13px;
    font-family: inherit;
    width: 80px;
    border-radius: 3px;
}
.inline-input:hover { border-color: #ddd; }
.inline-input:focus {
    border-color: #3498db;
    background: white;
    outline: none;
    box-shadow: 0 0 0 2px rgba(52,152,219,0.2);
}
.inline-narrow { width: 40px; text-align: center; }
.inline-wide { width: 120px; }
.inline-select {
    border: 1px solid transparent;
    background: transparent;
    padding: 1px 2px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    border-radius: 3px;
    max-width: 90px;
}
.inline-select:hover { border-color: #ddd; }
.inline-select:focus {
    border-color: #3498db;
    background: white;
    outline: none;
}
.btn-delete {
    background: none;
    border: none;
    color: #ccc;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    line-height: 1;
}
.btn-delete:hover { color: #e74c3c; background: #fee; }
.price-cell { font-weight: 500; }
.ads-table td { padding: 0.3rem 0.4rem; }
.ads-table th { padding: 0.4rem; font-size: 11px; }

/* Responsive */
@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .header-actions { margin-left: 0; }
    nav { flex-direction: column; height: auto; padding: 0.5rem; }
    .nav-links { flex-wrap: wrap; justify-content: center; }
    .nav-user { margin-left: 0; }
}
