:root {
    --qr-bg: #eef6fb;
    --qr-bg-accent: #dcebf4;
    --qr-surface: rgba(255, 255, 255, 0.94);
    --qr-surface-strong: #ffffff;
    --qr-ink: #18313d;
    --qr-muted: #617683;
    --qr-line: rgba(0, 87, 138, 0.12);
    --qr-line-strong: rgba(0, 87, 138, 0.2);
    --qr-primary: #00578A;
    --qr-primary-strong: #00466f;
    --qr-primary-soft: #edf6fb;
    --qr-secondary: #4D4F4E;
    --qr-success: #0f7b55;
    --qr-warning: #a86811;
    --qr-danger: #b42318;
    --qr-shadow: 0 18px 38px rgba(0, 58, 92, 0.12);
    --qr-radius: 22px;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: "SUIT Variable", "Noto Sans KR", sans-serif;
    color: var(--qr-ink);
    background:
        radial-gradient(circle at top left, rgba(0, 162, 225, 0.18), transparent 30%),
        radial-gradient(circle at top right, rgba(0, 87, 138, 0.1), transparent 28%),
        linear-gradient(180deg, var(--qr-bg) 0%, #f7fafc 100%);
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

.app-header,
.container,
.login-container {
    width: min(34rem, calc(100% - 24px));
    margin-left: auto;
    margin-right: auto;
}

.app-header {
    margin-top: 16px;
    margin-bottom: 14px;
    padding: 16px 18px !important;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.8) !important;
    border: 1px solid var(--qr-line);
    box-shadow: var(--qr-shadow);
    backdrop-filter: blur(14px);
    color: var(--qr-ink) !important;
}

.app-header h1 {
    margin: 0 !important;
    color: var(--qr-ink) !important;
    font-size: clamp(1.35rem, 4vw, 1.9rem) !important;
    display: flex;
    align-items: center;
    gap: 0.55rem !important;
}

.app-header a,
.app-header a i {
    color: var(--qr-primary) !important;
}

.header-top {
    align-items: flex-start !important;
}

.app-header .user-info,
.user-info {
    color: var(--qr-muted) !important;
    opacity: 1 !important;
    font-weight: 600;
    margin-top: 0.45rem !important;
}

.container {
    padding: 0 0 calc(88px + env(safe-area-inset-bottom));
}

.login-container {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding-top: 20px;
    padding-bottom: 40px;
    background: none !important;
}

.login-card {
    width: 100%;
    max-width: none;
    padding: 24px 20px;
    border-radius: 28px;
    background: var(--qr-surface);
    border: 1px solid var(--qr-line);
    box-shadow: var(--qr-shadow);
    backdrop-filter: blur(14px);
}

.login-logo {
    margin-bottom: 1.6rem;
}

.login-logo i {
    color: var(--qr-primary);
}

.login-logo h1 {
    color: var(--qr-ink);
}

.text-muted {
    color: var(--qr-muted) !important;
}

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--qr-secondary);
    font-weight: 700;
}

.form-control {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--qr-line-strong);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.98);
    color: var(--qr-ink);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.form-control:focus {
    outline: none;
    border-color: rgba(0, 87, 138, 0.36);
    box-shadow: 0 0 0 4px rgba(0, 87, 138, 0.08);
}

.btn {
    border-radius: 16px !important;
    border: 1px solid transparent;
    padding: 0.9rem 1rem;
    font-size: 1rem;
    font-weight: 700;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn:active {
    transform: scale(0.985);
}

.btn-primary {
    background: linear-gradient(135deg, var(--qr-primary) 0%, #0079c2 100%) !important;
    color: #fff !important;
    box-shadow: 0 12px 26px rgba(0, 87, 138, 0.18);
}

.btn-primary:active {
    background: linear-gradient(135deg, var(--qr-primary-strong) 0%, #006aa9 100%) !important;
}

.btn-outline-secondary,
.btn-outline-primary,
.btn-outline-danger {
    background: rgba(255, 255, 255, 0.92) !important;
    color: var(--qr-secondary) !important;
    border-color: var(--qr-line-strong) !important;
}

.btn-block {
    width: 100%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
}

.equipment-card,
.checklist,
.photo-upload,
.alert,
.module-card,
.notif-panel-new,
.notif-card,
.history-card,
.detail-box,
.check-item-card {
    border-radius: var(--qr-radius) !important;
    background: var(--qr-surface) !important;
    border: 1px solid var(--qr-line) !important;
    box-shadow: var(--qr-shadow) !important;
}

.equipment-card,
.checklist,
.photo-upload,
.alert {
    padding: 18px 16px !important;
}

.equipment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px !important;
}

.equipment-label,
.checklist-title,
.photo-upload-title,
.check-item-title {
    color: var(--qr-ink) !important;
    font-size: 1.02rem !important;
    font-weight: 700 !important;
}

.equipment-info,
.module-card .module-meta,
.detail-box .label,
.detail-box .value,
.history-card,
.install-toast-text span {
    color: var(--qr-muted) !important;
}

.equipment-info {
    line-height: 1.75 !important;
}

.equipment-status,
.field-note,
.mini-badge,
.module-chip {
    border-radius: 999px !important;
}

.status-normal {
    background: rgba(15, 123, 85, 0.12) !important;
    color: var(--qr-success) !important;
}

.status-warning {
    background: rgba(168, 104, 17, 0.12) !important;
    color: var(--qr-warning) !important;
}

.status-danger {
    background: rgba(180, 35, 24, 0.12) !important;
    color: var(--qr-danger) !important;
}

.status-neutral {
    background: rgba(77, 79, 78, 0.12) !important;
    color: var(--qr-secondary) !important;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 12px 13px !important;
    margin-bottom: 10px;
    border: 1px solid rgba(0, 87, 138, 0.08);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.88);
}

.checklist-item:last-child {
    margin-bottom: 0;
}

.checklist-item input[type="checkbox"] {
    accent-color: var(--qr-primary);
}

.photo-item,
.photo-thumb,
#qr-video {
    border-radius: 18px !important;
}

.photo-thumb {
    border: 1px solid rgba(0, 87, 138, 0.08) !important;
}

.upload-btn {
    border: 1px dashed rgba(0, 87, 138, 0.22);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(247, 251, 253, 0.98) 0%, rgba(237, 246, 251, 0.94) 100%);
}

.upload-btn i {
    color: var(--qr-primary);
}

.alert {
    margin-bottom: 1rem;
}

.alert-success {
    background: rgba(15, 123, 85, 0.12) !important;
    color: var(--qr-success) !important;
}

.alert-danger {
    background: rgba(180, 35, 24, 0.12) !important;
    color: var(--qr-danger) !important;
}

.alert-warning {
    background: rgba(168, 104, 17, 0.12) !important;
    color: var(--qr-warning) !important;
}

.alert-secondary {
    background: rgba(77, 79, 78, 0.1) !important;
    color: var(--qr-secondary) !important;
}

.bottom-action {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(34rem, calc(100% - 24px));
    padding: 14px 14px calc(14px + env(safe-area-inset-bottom)) !important;
    background: rgba(255, 255, 255, 0.92) !important;
    border: 1px solid var(--qr-line);
    border-bottom: none;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -16px 36px rgba(0, 58, 92, 0.14);
}

.install-toast {
    left: 50%;
    right: auto;
    bottom: 16px;
    transform: translateX(-50%);
    width: min(34rem, calc(100% - 24px));
    padding: 0;
    background: none !important;
    box-shadow: none !important;
    border: none !important;
}

.install-toast-content {
    background: rgba(24, 49, 61, 0.95);
    color: #fff;
    padding: 15px 16px;
    border-radius: 22px;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.25);
}

.ios-install-prompt {
    left: 50%;
    right: auto;
    bottom: 18px;
    width: min(34rem, calc(100% - 24px));
    transform: translateX(-50%);
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.module-card {
    padding: 16px;
}

.module-card.active {
    border-color: rgba(0, 87, 138, 0.24) !important;
    box-shadow: 0 10px 24px rgba(0, 87, 138, 0.12) !important;
}

.module-card .module-title {
    color: var(--qr-ink);
}

.notif-panel-new {
    border-radius: 28px 28px 0 0 !important;
}

.notif-card {
    padding: 14px 15px;
}

.unread-dot,
.notification-badge {
    background: var(--qr-primary) !important;
}

.row {
    display: grid;
    gap: 12px;
}

.col-12 {
    grid-column: 1 / -1;
}

@media (max-width: 540px) {
    .app-header,
    .container,
    .login-container {
        width: calc(100% - 24px);
    }

    .module-grid {
        grid-template-columns: 1fr;
    }

    .app-header h1 {
        font-size: 1.25rem !important;
    }
}
