* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Hiragino Sans', 'Noto Sans JP', -apple-system, sans-serif;
    background: #f5f7fa;
    color: #2d3748;
    line-height: 1.6;
}

.navbar {
    background: #2d3748;
    color: #fff;
    padding: 0 24px;
    display: flex;
    align-items: center;
    height: 56px;
    gap: 32px;
}
.nav-brand {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
}
.nav-links a {
    color: #cbd5e0;
    text-decoration: none;
    font-size: 14px;
    margin-right: 20px;
}
.nav-links a:hover { color: #fff; }

.container {
    max-width: 1100px;
    margin: 24px auto;
    padding: 0 20px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.page-header h1 { font-size: 22px; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    background: #fff;
    color: #2d3748;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s;
}
.btn:hover { background: #edf2f7; }
.btn-primary { background: #3182ce; color: #fff; border-color: #3182ce; }
.btn-primary:hover { background: #2b6cb0; }
.btn-green { background: #38a169; color: #fff; border-color: #38a169; }
.btn-green:hover { background: #2f855a; }
.btn-danger { background: #e53e3e; color: #fff; border-color: #e53e3e; }
.btn-danger:hover { background: #c53030; }
.btn-active { background: #2d3748; color: #fff; border-color: #2d3748; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 12px 32px; font-size: 16px; }

/* Filters */
.filters {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

/* Table */
.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.table th {
    background: #f7fafc;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
}
.table td {
    padding: 10px 14px;
    border-bottom: 1px solid #edf2f7;
    font-size: 14px;
}
.table tbody tr:hover { background: #f7fafc; }
.r { text-align: right; }
.actions { white-space: nowrap; }

/* Badge */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
}
.badge-gray { background: #edf2f7; color: #718096; }
.badge-blue { background: #ebf8ff; color: #2b6cb0; }
.badge-green { background: #f0fff4; color: #276749; }
.badge-orange { background: #fffaf0; color: #c05621; }
.badge-purple { background: #faf5ff; color: #6b46c1; }

/* Card */
.card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.card h2 { font-size: 16px; margin-bottom: 12px; }

/* Forms */
.form-inline {
    display: flex;
    gap: 10px;
    align-items: end;
    flex-wrap: wrap;
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #4a5568;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49,130,206,0.15);
}
textarea { resize: vertical; }

/* Invoice form */
.invoice-form { background: #fff; padding: 24px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.invoice-form h2 { font-size: 16px; margin: 20px 0 10px; }
.items-table input { width: 100%; }

.totals-box {
    text-align: right;
    margin: 20px 0;
    font-size: 15px;
    line-height: 2;
}
.total-line {
    font-size: 20px;
    font-weight: 700;
    color: #2d3748;
    border-top: 2px solid #2d3748;
    padding-top: 4px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* Month sections */
.month-section { margin-bottom: 24px; }
.month-header {
    font-size: 16px;
    font-weight: 700;
    color: #2d3748;
    padding: 10px 14px;
    background: #edf2f7;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
}
.month-header:hover { background: #e2e8f0; }
.month-toggle { font-size: 12px; transition: transform 0.2s; }
.month-count { font-weight: 400; font-size: 13px; color: #718096; }
.month-section.collapsed .table { display: none; }
.month-section.collapsed .month-toggle { transform: rotate(-90deg); }

/* Toggle contact column */
.hide-contact .col-contact { display: none; }

@media (max-width: 768px) {
    .form-grid { grid-template-columns: 1fr; }
    .table { font-size: 13px; }
    .container { padding: 0 12px; }
}
