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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: #333;
    min-height: 100vh;
    padding-bottom: env(safe-area-inset-bottom);
}

body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-container {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-container h1 {
    margin-bottom: 1.5rem;
    color: #1a73e8;
    font-size: 1.4rem;
}

.login-container form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-container label {
    font-weight: 600;
    text-align: left;
    font-size: 0.95rem;
}

.login-container input[type="password"] {
    padding: 0.85rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1.2rem;
    text-align: center;
    letter-spacing: 0.5rem;
}

.login-container input:focus {
    border-color: #1a73e8;
    outline: none;
}

.login-container button {
    background: #1a73e8;
    color: white;
    border: none;
    padding: 0.85rem;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 48px;
}

.login-container button:hover {
    background: #1557b0;
}

nav {
    background: #1a73e8;
    color: white;
    padding: 0.75rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

nav h2 {
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.nav-links a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s;
    white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
    background: rgba(255,255,255,0.2);
}

@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        padding-top: 0.75rem;
        gap: 0.25rem;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a {
        padding: 0.7rem 0.75rem;
        font-size: 1rem;
        border-radius: 6px;
    }
}

main {
    max-width: 1200px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}

h1 {
    font-size: 1.4rem;
    margin-bottom: 1.25rem;
    color: #1a1a1a;
}

h2 {
    font-size: 1.15rem;
    margin-bottom: 0.75rem;
    color: #444;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.card {
    background: white;
    padding: 1.25rem;
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}

.card h3 {
    color: #666;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    margin-bottom: 0.4rem;
}

.card .big {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1a73e8;
}

.card p {
    margin-top: 0.25rem;
    color: #666;
    font-size: 0.9rem;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    background: white;
    padding: 1rem;
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
    align-items: center;
}

.inline-form input,
.inline-form select {
    padding: 0.6rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    min-height: 44px;
    flex: 1;
    min-width: 120px;
}

.inline-form input:focus,
.inline-form select:focus {
    border-color: #1a73e8;
    outline: none;
}

button, .btn {
    background: #1a73e8;
    color: white;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    transition: background 0.2s;
}

button:hover {
    background: #1557b0;
}

.btn-secondary {
    background: #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-edit {
    background: #28a745;
}

.btn-edit:hover {
    background: #218838;
}

.btn-delete {
    background: #dc3545;
}

.btn-delete:hover {
    background: #c82333;
}

.btn-sm {
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
    min-height: 32px;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}

table {
    width: 100%;
    background: white;
    border-collapse: collapse;
    min-width: 600px;
}

th {
    background: #f8f9fa;
    text-align: left;
    padding: 0.7rem 0.75rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04rem;
    color: #666;
    border-bottom: 2px solid #e0e0e0;
    white-space: nowrap;
}

td {
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.88rem;
}

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

tr:hover {
    background: #f8f9fa;
}

.actions {
    display: flex;
    gap: 0.3rem;
    white-space: nowrap;
}

.empty {
    text-align: center;
    color: #999;
    padding: 2rem !important;
}

.success {
    background: #d4edda;
    color: #155724;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.category-list {
    list-style: none;
    background: white;
    padding: 0.5rem;
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}

.category-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
}

.category-list li:last-child {
    border-bottom: none;
}

.rents-form {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.5rem;
}

.rents-form button,
.rents-form .btn {
    grid-column: 1 / -1;
}

@media (max-width: 768px) {
    .two-col {
        grid-template-columns: 1fr;
    }

    .inline-form {
        flex-direction: column;
        align-items: stretch;
    }

    .inline-form input,
    .inline-form select {
        min-width: 0;
        width: 100%;
    }

    .inline-form button,
    .inline-form .btn {
        width: 100%;
    }

    .rents-form {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 1.25rem;
    }

    .card .big {
        font-size: 1.5rem;
    }

    .login-container {
        padding: 1.5rem;
    }

    .login-container h1 {
        font-size: 1.2rem;
    }

    .actions {
        flex-direction: column;
        gap: 0.25rem;
    }

    .actions .btn {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    main {
        margin: 1rem auto;
        padding: 0 0.75rem;
    }

    .card {
        padding: 1rem;
    }

    .inline-form {
        padding: 0.75rem;
    }

    table {
        font-size: 0.82rem;
    }

    th, td {
        padding: 0.5rem 0.5rem;
    }

    .category-list li {
        font-size: 0.85rem;
    }
}
