:root {
    --bg: #f2f5f8;
    --card: #ffffffcc;
    --muted: #6b7280;
    --accent: #007aff;
    --shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    --radius: 18px;
    --radius-sm: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    background: linear-gradient(180deg, var(--bg), #eef3f7);
    margin: 0;
    color: #0b1220;
    -webkit-tap-highlight-color: transparent;
    overflow: hidden;
}

.app {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 28px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px;
    min-height: 100vh;
}

.sidebar {
    background: rgba(255, 255, 255, 0.8);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    max-height: calc(100dvh - 64px);
    height: calc(100dvh - 64px);
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    backdrop-filter: blur(16px) saturate(120%);
    -webkit-backdrop-filter: blur(16px) saturate(120%);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), #34c759);
    display: grid;
    place-items: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.brand h1 {
    font-size: 16px;
    margin: 0;
}

.brand p {
    font-size: 13px;
    margin: 0;
    color: var(--muted);
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.controls .btn {
    width: 100%;
    margin-top: auto;
}

button.btn {
    border: 0;
    padding: 10px 14px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    font-size: 15px;
}

.btn.primary {
    background: linear-gradient(180deg, var(--accent), #0060d6);
    color: #fff;
}

.btn.ghost {
    background: transparent;
    border: 1px solid rgba(11, 18, 32, 0.1);
}

.btn.danger {
    color: #d73a49;
    border: 1px solid #d73a49;
    background: transparent;
}

.incident-list {
    overflow: auto;
    margin-top: 8px;
    padding: 8px;
    border-radius: 12px;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.incident-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
}

.incident-item:hover,
.incident-item.active {
    background: rgba(0, 0, 0, 0.05);
}

.incident-meta {
    flex: 1;
}

.incident-title {
    font-weight: 700;
    font-size: 14px;
}

.incident-sub {
    font-size: 13px;
    color: var(--muted);
}

.main {
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--radius);
    padding: 26px;
    box-shadow: var(--shadow);
    height: calc(100vh - 64px - 20px);
    overflow-y: auto;
    backdrop-filter: blur(20px) saturate(120%);
    -webkit-backdrop-filter: blur(20px) saturate(120%);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 22px;
}

.field {
    margin-bottom: 18px;
}

label {
    display: block;
    font-size: 15px;
    margin-bottom: 6px;
    color: #0b1220;
}

label.small {
    font-size: 12px;
    color: var(--muted);
}

input,
textarea,
select {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(11, 18, 32, 0.08);
    background: var(--card);
    outline: none;
    font-size: 15px;
    -webkit-appearance: none;
}

textarea {
    min-height: 80px;
    resize: vertical;
}

.required::after {
    content: " *";
    color: #d73a49;
}

.section-title {
    margin: 12px 0;
    margin-top: 24px;
    font-size: 18px;
    font-weight: 600;
}

.section-title:first-of-type {
    margin-top: 0;
}

.materials-list {
    margin-top: 8px;
}

.material-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.material-item input {
    flex: 1;
}

.remove-btn {
    background: #d73a49;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
}

.add-btn {
    margin-top: 6px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
}

.form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.small {
    font-size: 13px;
    color: var(--muted);
}

@media (max-width: 1024px) {
    .app {
        grid-template-columns: 1fr;
        padding: 20px;
        gap: 20px;
    }

    .sidebar {
        order: 2;
        min-height: auto;
    }

    .main {
        order: 1;
        min-height: auto;
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }
}

.account {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: background 0.2s;
}

.account .details {
    display: flex;
    align-items: center;
    gap: 10px;
}

.account i {
    font-size: 16px;
    color: #d73a49;
}

.account:hover {
    background: rgba(0, 0, 0, 0.05);
}

.account-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #34c759);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.account-info {
    display: flex;
    flex-direction: column;
}

.account-info strong {
    font-size: 16px;
}

.account-info span {
    font-size: 13px;
    color: var(--muted);
}

.login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-modal {
    background: #fff;
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 32px;
    width: 100%;
    max-width: 360px;
    text-align: center;
    animation: slideDown 0.4s ease;
}

.login-modal h2 {
    margin: 0;
    font-size: 22px;
}

.login-modal .subtitle {
    margin: 6px 0 20px;
    font-size: 14px;
    color: var(--muted);
}

.login-modal form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-modal input {
    padding: 12px;
    font-size: 15px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: var(--card);
    outline: none;
    text-align: center;
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.code-inputs {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 8px;
}

.code-inputs input {
    width: 44px;
    height: 56px;
    text-align: center;
    font-size: 22px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    background: var(--card);
    outline: none;
    transition: border-color 0.2s;
}

.code-inputs input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.2);
}
